<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <title>blog.bdoughan</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link type='text/css' rel='stylesheet' href='../css/widget.css' />
          <link type='text/css' rel='stylesheet' href='../css/widget.css' />
            <link type='text/css' rel='stylesheet' href='../css/widget.css' />
<!--            <link href="../css/cmtfp.css"
        rel="stylesheet" type="text/css">-->
<!--             <link href="http://www.blogger.com/static/v1/v-css/4124270156-cmtfp.css"
        rel="stylesheet" type="text/css">-->
        <style id='page-skin-1' type='text/css'><!--
/*-----------------------------------------------
Blogger Template Style
Name:     Picture Window
Designer: Josh Peterson
URL:      www.noaesthetic.com
----------------------------------------------- */
/* Variable definitions
====================
<Variable name="keycolor" description="Main Color" type="color" default="#1a222a"/>
<Variable name="body.background" description="Body Background" type="background"
color="#111111" default="#111111 url(http://themes.googleusercontent.com/image?id=1OACCYOE0-eoTRTfsBuX1NMN9nz599ufI1Jh0CggPFA_sK80AGkIr8pLtYRpNUKPmwtEa) repeat-x fixed top center"/>
<Group description="Page Text" selector="body">
<Variable name="body.font" description="Font" type="font"
default="normal normal 15px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/>
<Variable name="body.text.color" description="Text Color" type="color" default="#333333"/>
</Group>
<Group description="Backgrounds" selector=".body-fauxcolumns-outer">
<Variable name="body.background.color" description="Outer Background" type="color" default="#296695"/>
<Variable name="header.background.color" description="Header Background" type="color" default="transparent"/>
<Variable name="post.background.color" description="Post Background" type="color" default="#ffffff"/>
</Group>
<Group description="Links" selector=".main-outer">
<Variable name="link.color" description="Link Color" type="color" default="#336699"/>
<Variable name="link.visited.color" description="Visited Color" type="color" default="#6699cc"/>
<Variable name="link.hover.color" description="Hover Color" type="color" default="#33aaff"/>
</Group>
<Group description="Blog Title" selector=".header h1">
<Variable name="header.font" description="Title Font" type="font"
default="normal normal 36px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/>
<Variable name="header.text.color" description="Text Color" type="color" default="#ffffff" />
</Group>
<Group description="Tabs Text" selector=".tabs-inner .widget li a">
<Variable name="tabs.font" description="Font" type="font"
default="normal normal 15px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/>
<Variable name="tabs.text.color" description="Text Color" type="color" default="#ffffff"/>
<Variable name="tabs.selected.text.color" description="Selected Color" type="color" default="#336699"/>
</Group>
<Group description="Tabs Background" selector=".tabs-outer .PageList">
<Variable name="tabs.background.color" description="Background Color" type="color" default="transparent"/>
<Variable name="tabs.selected.background.color" description="Selected Color" type="color" default="transparent"/>
<Variable name="tabs.separator.color" description="Separator Color" type="color" default="transparent"/>
</Group>
<Group description="Post Title" selector="h3.post-title, .comments h4">
<Variable name="post.title.font" description="Title Font" type="font"
default="normal normal 18px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/>
</Group>
<Group description="Date Header" selector=".date-header">
<Variable name="date.header.color" description="Text Color" type="color" default="#333333"/>
</Group>
<Group description="Post" selector=".post">
<Variable name="post.footer.text.color" description="Footer Text Color" type="color" default="#999999"/>
<Variable name="post.border.color" description="Border Color" type="color" default="#dddddd"/>
</Group>
<Group description="Gadgets" selector="h2">
<Variable name="widget.title.font" description="Title Font" type="font"
default="bold normal 13px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/>
<Variable name="widget.title.text.color" description="Title Color" type="color" default="#888888"/>
</Group>
<Group description="Footer" selector=".footer-outer">
<Variable name="footer.text.color" description="Text Color" type="color" default="#cccccc"/>
<Variable name="footer.widget.title.text.color" description="Gadget Title Color" type="color" default="#aaaaaa"/>
</Group>
<Group description="Footer Links" selector=".footer-outer">
<Variable name="footer.link.color" description="Link Color" type="color" default="#99ccee"/>
<Variable name="footer.link.visited.color" description="Visited Color" type="color" default="#77aaee"/>
<Variable name="footer.link.hover.color" description="Hover Color" type="color" default="#33aaff"/>
</Group>
<Variable name="content.margin" description="Content Margin Top" type="length" default="20px"/>
<Variable name="content.padding" description="Content Padding" type="length" default="0"/>
<Variable name="content.background" description="Content Background" type="background"
default="transparent none repeat scroll top left"/>
<Variable name="content.border.radius" description="Content Border Radius" type="length" default="0"/>
<Variable name="content.shadow.spread" description="Content Shadow Spread" type="length" default="0"/>
<Variable name="header.padding" description="Header Padding" type="length" default="0"/>
<Variable name="header.background.gradient" description="Header Gradient" type="url"
default="none"/>
<Variable name="header.border.radius" description="Header Border Radius" type="length" default="0"/>
<Variable name="main.border.radius.top" description="Main Border Radius" type="length" default="20px"/>
<Variable name="footer.border.radius.top" description="Footer Border Radius Top" type="length" default="0"/>
<Variable name="footer.border.radius.bottom" description="Footer Border Radius Bottom" type="length" default="20px"/>
<Variable name="region.shadow.spread" description="Main and Footer Shadow Spread" type="length" default="3px"/>
<Variable name="region.shadow.offset" description="Main and Footer Shadow Offset" type="length" default="1px"/>
<Variable name="tabs.background.gradient" description="Tab Background Gradient" type="url" default="none"/>
<Variable name="tab.selected.background.gradient" description="Selected Tab Background" type="url"
default="url(http://www.blogblog.com/1kt/transparent/white80.png)"/>
<Variable name="tab.background" description="Tab Background" type="background"
default="transparent url(http://www.blogblog.com/1kt/transparent/black50.png) repeat scroll top left"/>
<Variable name="tab.border.radius" description="Tab Border Radius" type="length" default="10px" />
<Variable name="tab.first.border.radius" description="First Tab Border Radius" type="length" default="10px" />
<Variable name="tabs.border.radius" description="Tabs Border Radius" type="length" default="0" />
<Variable name="tabs.spacing" description="Tab Spacing" type="length" default=".25em"/>
<Variable name="tabs.margin.bottom" description="Tab Margin Bottom" type="length" default="0"/>
<Variable name="tabs.margin.sides" description="Tab Margin Sides" type="length" default="20px"/>
<Variable name="main.background" description="Main Background" type="background"
default="transparent url(http://www.blogblog.com/1kt/transparent/white80.png) repeat scroll top left"/>
<Variable name="main.padding.sides" description="Main Padding Sides" type="length" default="20px"/>
<Variable name="footer.background" description="Footer Background" type="background"
default="transparent url(http://www.blogblog.com/1kt/transparent/black50.png) repeat scroll top left"/>
<Variable name="post.margin.sides" description="Post Margin Sides" type="length" default="-20px"/>
<Variable name="post.border.radius" description="Post Border Radius" type="length" default="5px"/>
<Variable name="widget.title.text.transform" description="Widget Title Text Transform" type="string" default="uppercase"/>
<Variable name="mobile.background.overlay" description="Mobile Background Overlay" type="string"
default="transparent none repeat scroll top left"/>
<Variable name="startSide" description="Side where text starts in blog language" type="automatic" default="left"/>
<Variable name="endSide" description="Side where text ends in blog language" type="automatic" default="right"/>
*/
/* Content
----------------------------------------------- */
body {
font: normal normal 15px Arial, Tahoma, Helvetica, FreeSans, sans-serif;
color: #333333;
background: #111111 url(http://2.bp.blogspot.com/-7yWCYjQfC-M/TjnbMtm0Q5I/AAAAAAAAACg/Yg08TYip7Bc/s1600/th_blue.jpg) repeat fixed top left;
}
html body .region-inner {
min-width: 0;
max-width: 100%;
width: auto;
}
.content-outer {
font-size: 90%;
}
a:link {
text-decoration:none;
color: #336699;
}
a:visited {
text-decoration:none;
color: #6699cc;
}
a:hover {
text-decoration:underline;
color: #33aaff;
}
.content-outer {
background: transparent none repeat scroll top left;
-moz-border-radius: 0;
-webkit-border-radius: 0;
-goog-ms-border-radius: 0;
border-radius: 0;
-moz-box-shadow: 0 0 0 rgba(0, 0, 0, .15);
-webkit-box-shadow: 0 0 0 rgba(0, 0, 0, .15);
-goog-ms-box-shadow: 0 0 0 rgba(0, 0, 0, .15);
box-shadow: 0 0 0 rgba(0, 0, 0, .15);
margin: 20px auto;
}
.content-inner {
padding: 0;
}
/* Header
----------------------------------------------- */
.header-outer {
background: transparent none repeat-x scroll top left;
_background-image: none;
color: #ffffff;
-moz-border-radius: 0;
-webkit-border-radius: 0;
-goog-ms-border-radius: 0;
border-radius: 0;
}
.Header img, .Header #header-inner {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-goog-ms-border-radius: 0;
border-radius: 0;
}
.header-inner .Header .titlewrapper,
.header-inner .Header .descriptionwrapper {
padding-left: 0;
padding-right: 0;
}
.Header h1 {
font: normal normal 36px Arial, Tahoma, Helvetica, FreeSans, sans-serif;
text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}
.Header h1 a {
color: #ffffff;
}
.Header .description {
font-size: 130%;
}
/* Tabs
----------------------------------------------- */
.tabs-inner {
margin: .5em 20px 0;
padding: 0;
}
.tabs-inner .section {
margin: 0;
}
.tabs-inner .widget ul {
padding: 0;
background: transparent none repeat scroll bottom;
-moz-border-radius: 0;
-webkit-border-radius: 0;
-goog-ms-border-radius: 0;
border-radius: 0;
}
.tabs-inner .widget li {
border: none;
}
.tabs-inner .widget li a {
display: inline-block;
padding: .5em 1em;
margin-right: .25em;
color: #ffffff;
font: normal normal 15px Arial, Tahoma, Helvetica, FreeSans, sans-serif;
-moz-border-radius: 10px 10px 0 0;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-goog-ms-border-radius: 10px 10px 0 0;
border-radius: 10px 10px 0 0;
background: transparent url(http://www.blogblog.com/1kt/transparent/black50.png) repeat scroll top left;
border-right: 1px solid transparent;
}
.tabs-inner .widget li:first-child a {
padding-left: 1.25em;
-moz-border-radius-topleft: 10px;
-moz-border-radius-bottomleft: 0;
-webkit-border-top-left-radius: 10px;
-webkit-border-bottom-left-radius: 0;
-goog-ms-border-top-left-radius: 10px;
-goog-ms-border-bottom-left-radius: 0;
border-top-left-radius: 10px;
border-bottom-left-radius: 0;
}
.tabs-inner .widget li.selected a,
.tabs-inner .widget li a:hover {
position: relative;
z-index: 1;
background: transparent url(http://www.blogblog.com/1kt/transparent/white80.png) repeat scroll bottom;
color: #336699;
-moz-box-shadow: 0 0 3px rgba(0, 0, 0, .15);
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, .15);
-goog-ms-box-shadow: 0 0 3px rgba(0, 0, 0, .15);
box-shadow: 0 0 3px rgba(0, 0, 0, .15);
}
/* Headings
----------------------------------------------- */
h2 {
font: bold normal 13px Arial, Tahoma, Helvetica, FreeSans, sans-serif;
text-transform: uppercase;
color: #888888;
margin: .5em 0;
}
/* Main
----------------------------------------------- */
.main-outer {
background: transparent url(http://www.blogblog.com/1kt/transparent/white80.png) repeat scroll top left;
-moz-border-radius: 20px 20px 0 0;
-webkit-border-top-left-radius: 20px;
-webkit-border-top-right-radius: 20px;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
-goog-ms-border-radius: 20px 20px 0 0;
border-radius: 20px 20px 0 0;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
-goog-ms-box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.main-inner {
padding: 15px 20px 20px;
}
.main-inner .column-center-inner {
padding: 0 0;
}
.main-inner .column-left-inner {
padding-left: 0;
}
.main-inner .column-right-inner {
padding-right: 0;
}
/* Posts
----------------------------------------------- */
h3.post-title {
margin: 0;
font: normal bold 20px Arial, Tahoma, Helvetica, FreeSans, sans-serif;
}
.comments h4 {
margin: 1em 0 0;
font: normal bold 20px Arial, Tahoma, Helvetica, FreeSans, sans-serif;
}
.date-header span {
color: #333333;
}
.post-outer {
background-color: #ffffff;
border: solid 1px #dddddd;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-goog-ms-border-radius: 5px;
padding: 15px 20px;
margin: 0 -20px 20px;
}
.post-body {
line-height: 1.4;
font-size: 110%;
position: relative;
}
.post-header {
margin: 0 0 1.5em;
color: #999999;
line-height: 1.6;
}
.post-footer {
margin: .5em 0 0;
color: #999999;
line-height: 1.6;
}
#blog-pager {
font-size: 140%
}
#comments .comment-author {
padding-top: 1.5em;
border-top: dashed 1px #ccc;
border-top: dashed 1px rgba(128, 128, 128, .5);
background-position: 0 1.5em;
}
#comments .comment-author:first-child {
padding-top: 0;
border-top: none;
}
.avatar-image-container {
margin: .2em 0 0;
}
/* Widgets
----------------------------------------------- */
.widget ul, .widget #ArchiveList ul.flat {
padding: 0;
list-style: none;
}
.widget ul li, .widget #ArchiveList ul.flat li {
border-top: dashed 1px #ccc;
border-top: dashed 1px rgba(128, 128, 128, .5);
}
.widget ul li:first-child, .widget #ArchiveList ul.flat li:first-child {
border-top: none;
}
.widget .post-body ul {
list-style: disc;
}
.widget .post-body ul li {
border: none;
}
/* Footer
----------------------------------------------- */
.footer-outer {
color:#cccccc;
background: transparent url(http://www.blogblog.com/1kt/transparent/black50.png) repeat scroll top left;
-moz-border-radius: 0 0 20px 20px;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 20px;
-webkit-border-bottom-right-radius: 20px;
-goog-ms-border-radius: 0 0 20px 20px;
border-radius: 0 0 20px 20px;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
-goog-ms-box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.footer-inner {
padding: 10px 20px 20px;
}
.footer-outer a {
color: #99ccee;
}
.footer-outer a:visited {
color: #77aaee;
}
.footer-outer a:hover {
color: #33aaff;
}
.footer-outer .widget h2 {
color: #aaaaaa;
}
/* Mobile
----------------------------------------------- */
html body.mobile {
height: auto;
}
html body.mobile {
min-height: 480px;
background-size: 100% auto;
}
.mobile .body-fauxcolumn-outer {
background: transparent none repeat scroll top left;
}
html .mobile .mobile-date-outer, html .mobile .blog-pager {
border-bottom: none;
background: transparent url(http://www.blogblog.com/1kt/transparent/white80.png) repeat scroll top left;
margin-bottom: 10px;
}
.mobile .date-outer {
background: transparent url(http://www.blogblog.com/1kt/transparent/white80.png) repeat scroll top left;
}
.mobile .header-outer, .mobile .main-outer,
.mobile .post-outer, .mobile .footer-outer {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-goog-ms-border-radius: 0;
border-radius: 0;
}
.mobile .content-outer,
.mobile .main-outer,
.mobile .post-outer {
background: inherit;
border: none;
}
.mobile .content-outer {
font-size: 100%;
}
.mobile-link-button {
background-color: #336699;
}
.mobile-link-button a:link, .mobile-link-button a:visited {
color: #ffffff;
}
.mobile-index-contents {
color: #333333;
}
.mobile .tabs-inner .PageList .widget-content {
background: transparent url(http://www.blogblog.com/1kt/transparent/white80.png) repeat scroll bottom;
color: #336699;
}
.mobile .tabs-inner .PageList .widget-content .pagelist-arrow {
border-left: 1px solid transparent;
}

--></style>
<style id='template-skin-1' type='text/css'><!--
body {
min-width: 940px;
}
.content-outer, .content-fauxcolumn-outer, .region-inner {
min-width: 940px;
max-width: 940px;
_width: 940px;
}
.main-inner .columns {
padding-left: 0;
padding-right: 260px;
}
.main-inner .fauxcolumn-center-outer {
left: 0;
right: 260px;
/* IE6 does not respect left and right together */
_width: expression(this.parentNode.offsetWidth -
parseInt("0") -
parseInt("260px") + 'px');
}
.main-inner .fauxcolumn-left-outer {
width: 0;
}
.main-inner .fauxcolumn-right-outer {
width: 260px;
}
.main-inner .column-left-outer {
width: 0;
right: 100%;
margin-left: -0;
}
.main-inner .column-right-outer {
width: 260px;
margin-right: -260px;
}
#layout {
min-width: 0;
}
#layout .content-outer {
min-width: 0;
width: 800px;
}
#layout .region-inner {
min-width: 0;
width: auto;
}
--></style>
    </head>
    <body>
        <div id="navbar" class="navbar section"><div id="Navbar1" class="widget Navbar"><script type="text/javascript" async="" src="https://apis.google.com/js/plusone.js"></script><script type="text/javascript">
            function setAttributeOnload(object, attribute, val) {
                if(window.addEventListener) {
                    window.addEventListener("load",
                    function(){ object[attribute] = val; }, false);
                } else {
                    window.attachEvent('onload', function(){ object[attribute] = val; });
                }
            }
                </script>
                <iframe width="100%" scrolling="no" height="30px" frameborder="0" title="Blogger Navigation and Search" allowtransparency="true" id="navbar-iframe" marginheight="0" marginwidth="0" src="navbar.html"></iframe>
                <div></div></div></div>
        
        
<div class="fauxcolumn-outer body-fauxcolumn-outer">
<div class="cap-top">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
<div class="fauxborder-left">
<div class="fauxborder-right"></div>
<div class="fauxcolumn-inner">
</div>
</div>
<div class="cap-bottom">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
</div>

        
<div class="content-fauxcolumns">
<div class="fauxcolumn-outer content-fauxcolumn-outer">
<div class="cap-top">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
<div class="fauxborder-left">
<div class="fauxborder-right"></div>
<div class="fauxcolumn-inner">
</div>
</div>
<div class="cap-bottom">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
</div>
</div>
<div class="content-outer">
<div class="content-cap-top cap-top">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
<div class="fauxborder-left content-fauxborder-left">
<div class="fauxborder-right content-fauxborder-right"></div>
<div class="content-inner">
<header>
<div class="header-outer">
<div class="header-cap-top cap-top">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
<div class="fauxborder-left header-fauxborder-left">
<div class="fauxborder-right header-fauxborder-right"></div>
<div class="region-inner header-inner">
<div class="header section" id="header"><div class="widget Header" id="Header1">
<div id="header-inner">
<div class="titlewrapper">
<h1 class="title">
<a href="http://blog.bdoughan.com/">Java XML &amp; JSON Binding</a>
</h1>
</div>
<div class="descriptionwrapper">
<p class="description"><span>Object-to-XML and object-to-JSON mapping using JAXB and EclipseLink MOXy.</span></p>
</div>
</div>
</div></div>
</div>
</div>
<div class="header-cap-bottom cap-bottom">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
</div>
</header>
<div class="tabs-outer">
<div class="tabs-cap-top cap-top">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
<div class="fauxborder-left tabs-fauxborder-left">
<div class="fauxborder-right tabs-fauxborder-right"></div>
<div class="region-inner tabs-inner">
<div class="tabs section" id="crosscol"><div class="widget PageList" id="PageList1">
<h2>Pages</h2>
<div class="widget-content">
<ul>
<li><a href="http://blog.bdoughan.com/">Home </a></li>
<li><a href="http://blog.bdoughan.com/p/table-of-contents.html">Table of Contents</a></li>
<li><a href="http://blog.bdoughan.com/p/contact_01.html">Contact Me </a></li>
</ul>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=PageList&amp;widgetId=PageList1&amp;action=editWidget&amp;sectionId=crosscol" onclick='return _WidgetManager._PopupConfig(document.getElementById("PageList1"));' target="configPageList1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div>
</div></div>
<div class="tabs section" id="crosscol-overflow"></div>
</div>
</div>
<div class="tabs-cap-bottom cap-bottom">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
</div>
<div class="main-outer">
<div class="main-cap-top cap-top">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
<div class="fauxborder-left main-fauxborder-left">
<div class="fauxborder-right main-fauxborder-right"></div>
<div class="region-inner main-inner">
<div class="columns fauxcolumns">
<div class="fauxcolumn-outer fauxcolumn-center-outer">
<div class="cap-top">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
<div class="fauxborder-left">
<div class="fauxborder-right"></div>
<div class="fauxcolumn-inner">
</div>
</div>
<div class="cap-bottom">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
</div>
<div class="fauxcolumn-outer fauxcolumn-left-outer">
<div class="cap-top">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
<div class="fauxborder-left">
<div class="fauxborder-right"></div>
<div class="fauxcolumn-inner">
</div>
</div>
<div class="cap-bottom">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
</div>
<div class="fauxcolumn-outer fauxcolumn-right-outer">
<div class="cap-top">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
<div class="fauxborder-left">
<div class="fauxborder-right"></div>
<div class="fauxcolumn-inner">
</div>
</div>
<div class="cap-bottom">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
</div>
<!-- corrects IE6 width calculation -->
<div class="columns-inner">
<div class="column-center-outer">
<div class="column-center-inner">
<div class="main section" id="main"><div class="widget Blog" id="Blog1">
<div class="blog-posts hfeed">
<!-- google_ad_section_start(name=default) -->

          <div class="date-outer">
        
<h2 class="date-header"><span>October 25, 2010</span></h2>

          <div class="date-posts">
        
<div class="post-outer">
<div class="post hentry">
<a name="1878841028455754447"></a>
<h3 class="post-title entry-title">
How Does JAXB Compare to Simple?
</h3>
<div class="post-header">
<div class="post-header-line-1"></div>
</div>
<div class="post-body entry-content" id="post-body-1878841028455754447">
<span style="font-family: Arial,Helvetica,sans-serif;"><span id="goog_1851233904"></span>In a <a href="http://bdoughan.blogspot.com/2010/10/how-does-jaxb-compare-to-xstream.html">previous post</a> I compared JAXB to <a href="http://xstream.codehaus.org/">XStream</a>.<span id="goog_1851233905"></span>&nbsp; In this post I'll run that comparison with the <a href="http://simple.sourceforge.net/">Simple XML Serialization</a> framework.</span><br>
<br>
<span style="font-family: Arial; font-size: large;"><b>Java Model</b></span><br>
<br>
<span style="font-family: Arial;">We will use the following model for this example.&nbsp; The classes represent customer data.&nbsp; The get/set methods have been omitted to save space.</span><br>
<br>
<div><div id="highlighter_399530" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">java.util.ArrayList;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">java.util.List;</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Customer {</code></div><div class="line number7 index6 alt2">&nbsp;</div><div class="line number8 index7 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java keyword">long</code> <code class="java plain">id;</code></div><div class="line number9 index8 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String name;</code></div><div class="line number10 index9 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">Address address;</code></div><div class="line number11 index10 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">List&lt;PhoneNumber&gt; phoneNumbers;</code></div><div class="line number12 index11 alt1">&nbsp;</div><div class="line number13 index12 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">public</code> <code class="java plain">Customer() {</code></div><div class="line number14 index13 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">phoneNumbers = </code><code class="java keyword">new</code> <code class="java plain">ArrayList&lt;PhoneNumber&gt;();</code></div><div class="line number15 index14 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">}</code></div><div class="line number16 index15 alt1">&nbsp;</div><div class="line number17 index16 alt2"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<div><div id="highlighter_798745" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Address {</code></div><div class="line number4 index3 alt1">&nbsp;</div><div class="line number5 index4 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String city;</code></div><div class="line number6 index5 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String street;</code></div><div class="line number7 index6 alt2">&nbsp;</div><div class="line number8 index7 alt1"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<div><div id="highlighter_110940" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">PhoneNumber {</code></div><div class="line number4 index3 alt1">&nbsp;</div><div class="line number5 index4 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String type;</code></div><div class="line number6 index5 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String number;</code></div><div class="line number7 index6 alt2">&nbsp;</div><div class="line number8 index7 alt1"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<span style="font-family: Arial,Helvetica,sans-serif; font-size: large;"><b>Customer Data</b></span><br>
<br>
<span style="font-family: Arial;">The following instance of Customer will be marshalled to XML using both JAXB and Simple.</span><br>
<br>
<div><div id="highlighter_833900" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div><div class="line number18 index17 alt1">18</div><div class="line number19 index18 alt2">19</div><div class="line number20 index19 alt1">20</div><div class="line number21 index20 alt2">21</div><div class="line number22 index21 alt1">22</div><div class="line number23 index22 alt2">23</div><div class="line number24 index23 alt1">24</div><div class="line number25 index24 alt2">25</div><div class="line number26 index25 alt1">26</div><div class="line number27 index26 alt2">27</div><div class="line number28 index27 alt1">28</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Data {</code></div><div class="line number4 index3 alt1">&nbsp;</div><div class="line number5 index4 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">public</code> <code class="java keyword">static</code> <code class="java plain">Customer CUSTOMER;</code></div><div class="line number6 index5 alt1">&nbsp;</div><div class="line number7 index6 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">static</code> <code class="java plain">{</code></div><div class="line number8 index7 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">CUSTOMER = </code><code class="java keyword">new</code> <code class="java plain">Customer();</code></div><div class="line number9 index8 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">CUSTOMER.setId(</code><code class="java value">123</code><code class="java plain">);</code></div><div class="line number10 index9 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">CUSTOMER.setName(</code><code class="java string">"Jane Doe"</code><code class="java plain">);</code></div><div class="line number11 index10 alt2">&nbsp;</div><div class="line number12 index11 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">Address address = </code><code class="java keyword">new</code> <code class="java plain">Address();</code></div><div class="line number13 index12 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">address.setStreet(</code><code class="java string">"1 A Street"</code><code class="java plain">);</code></div><div class="line number14 index13 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">address.setCity(</code><code class="java string">"Any Town"</code><code class="java plain">);</code></div><div class="line number15 index14 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">CUSTOMER.setAddress(address);</code></div><div class="line number16 index15 alt1">&nbsp;</div><div class="line number17 index16 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">PhoneNumber workPhoneNumber = </code><code class="java keyword">new</code> <code class="java plain">PhoneNumber();</code></div><div class="line number18 index17 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">workPhoneNumber.setType(</code><code class="java string">"work"</code><code class="java plain">);</code></div><div class="line number19 index18 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">workPhoneNumber.setNumber(</code><code class="java string">"555-WORK"</code><code class="java plain">);</code></div><div class="line number20 index19 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">CUSTOMER.getPhoneNumbers().add(workPhoneNumber);</code></div><div class="line number21 index20 alt2">&nbsp;</div><div class="line number22 index21 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">PhoneNumber cellPhoneNumber = </code><code class="java keyword">new</code> <code class="java plain">PhoneNumber();</code></div><div class="line number23 index22 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">cellPhoneNumber.setType(</code><code class="java string">"cell"</code><code class="java plain">);</code></div><div class="line number24 index23 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">cellPhoneNumber.setNumber(</code><code class="java string">"555-CELL"</code><code class="java plain">);</code></div><div class="line number25 index24 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">CUSTOMER.getPhoneNumbers().add(cellPhoneNumber);</code></div><div class="line number26 index25 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">}</code></div><div class="line number27 index26 alt2">&nbsp;</div><div class="line number28 index27 alt1"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<span style="font-family: Arial,Helvetica,sans-serif; font-size: large;"><b>Marshal Code</b></span><br>
<br>
<span style="font-family: Arial;">This is the code we will use to convert the objects to XML.</span><br>
<br>
<span style="font-family: Arial,Helvetica,sans-serif;"><b>Simple&nbsp;</b></span><br>
<br>
<span style="font-family: Arial;">The following code will be used to marshal the instance of Customer to an OutputStream.&nbsp; The&nbsp;Simple code is quite compact.</span><br>
<br>
<div><div id="highlighter_418812" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison.simplexml;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Serializer;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.core.Persister;</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1"><code class="java keyword">import</code> <code class="java keyword">static</code> <code class="java plain">comparison.Data.CUSTOMER;</code></div><div class="line number7 index6 alt2">&nbsp;</div><div class="line number8 index7 alt1"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">SimpleXMLDemo {</code></div><div class="line number9 index8 alt2">&nbsp;</div><div class="line number10 index9 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">public</code> <code class="java keyword">static</code> <code class="java keyword">void</code> <code class="java plain">main(String[] args) </code><code class="java keyword">throws</code> <code class="java plain">Exception {</code></div><div class="line number11 index10 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">Serializer serializer = </code><code class="java keyword">new</code> <code class="java plain">Persister();</code></div><div class="line number12 index11 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">serializer.write(CUSTOMER, System.out);</code></div><div class="line number13 index12 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">}</code></div><div class="line number14 index13 alt1"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<span style="font-family: Arial,Helvetica,sans-serif;"><b>JAXB</b></span><br>
<br>
<span style="font-family: Arial;">The following code will be used to marshal the instance of Customer to an OutputStream.&nbsp; A couple of differences are already apparent:</span><br>
<ol><li><span style="font-family: Arial;">A JAXBContext needs to be initialized on the binding metadata before the marshal operation can occur.&nbsp; This initialization enables JAXB to optimize how the conversion will be done.&nbsp; The JAXBContext is thead safe and only needs to be created once.</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Unlike Simple, JAXB does not format the XML by&nbsp;default, so we will&nbsp;enable this feature.</span></li>
<li><span style="font-family: Arial;">With no metadata specified we need to supply JAXB with a root element name (and namespace).</span></li>
</ol><div><div id="highlighter_481834" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div><div class="line number18 index17 alt1">18</div><div class="line number19 index18 alt2">19</div><div class="line number20 index19 alt1">20</div><div class="line number21 index20 alt2">21</div><div class="line number22 index21 alt1">22</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison.jaxb;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.JAXBContext;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.JAXBElement;</code></div><div class="line number5 index4 alt2"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.Marshaller;</code></div><div class="line number6 index5 alt1"><code class="java keyword">import</code> <code class="java plain">javax.xml.namespace.QName;</code></div><div class="line number7 index6 alt2"><code class="java keyword">import</code> <code class="java plain">comparison.Customer;</code></div><div class="line number8 index7 alt1">&nbsp;</div><div class="line number9 index8 alt2"><code class="java keyword">import</code> <code class="java keyword">static</code> <code class="java plain">comparison.Data.CUSTOMER;</code></div><div class="line number10 index9 alt1">&nbsp;</div><div class="line number11 index10 alt2"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">JAXBDemo {</code></div><div class="line number12 index11 alt1">&nbsp;</div><div class="line number13 index12 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">public</code> <code class="java keyword">static</code> <code class="java keyword">void</code> <code class="java plain">main(String[] args) </code><code class="java keyword">throws</code> <code class="java plain">Exception {</code></div><div class="line number14 index13 alt1">&nbsp;</div><div class="line number15 index14 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">JAXBContext jc = JAXBContext.newInstance(Customer.</code><code class="java keyword">class</code><code class="java plain">);</code></div><div class="line number16 index15 alt1">&nbsp;</div><div class="line number17 index16 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">Marshaller marshaller = jc.createMarshaller();</code></div><div class="line number18 index17 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, </code><code class="java keyword">true</code><code class="java plain">);</code></div><div class="line number19 index18 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">JAXBElement&lt;Customer&gt; jaxbElement = </code><code class="java keyword">new</code> <code class="java plain">JAXBElement&lt;Customer&gt;(</code><code class="java keyword">new</code> <code class="java plain">QName(</code><code class="java string">"customer"</code><code class="java plain">), Customer.</code><code class="java keyword">class</code><code class="java plain">, CUSTOMER);</code></div><div class="line number20 index19 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">marshaller.marshal(jaxbElement, System.out);</code></div><div class="line number21 index20 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">}</code></div><div class="line number22 index21 alt1"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><div class="brush: java; toolbar: false"><br>
<span style="font-family: Arial,Helvetica,sans-serif; font-size: large;"><b>Default XML Output</b></span><br>
<br>
<span style="font-family: Arial;">First we will examine the XML output produced by both&nbsp;Simple and JAXB if no metadata is used to customize the output.</span><br>
<br>
<span style="font-family: Arial,Helvetica,sans-serif;"><b>Simple</b></span><br>
<br>
<span style="font-family: Arial,Helvetica,sans-serif;">Simple&nbsp;will throw the following exception if no metadata has been defined.</span><br>
<br>
<span style="font-family: Arial,Helvetica,sans-serif;"> </span></div><div class="brush: java; toolbar: false"><div><div id="highlighter_669823" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java plain">Exception in thread </code><code class="java string">"main"</code> <code class="java plain">org.simpleframework.xml.transform.TransformException: Transform of </code><code class="java keyword">class</code> <code class="java plain">comparison.Customer not supported</code></div><div class="line number2 index1 alt1"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.transform.Transformer.write(Transformer.java:</code><code class="java value">122</code><code class="java plain">)</code></div><div class="line number3 index2 alt2"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Support.write(Support.java:</code><code class="java value">200</code><code class="java plain">)</code></div><div class="line number4 index3 alt1"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.PrimitiveFactory.getText(PrimitiveFactory.java:</code><code class="java value">112</code><code class="java plain">)</code></div><div class="line number5 index4 alt2"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Primitive.write(Primitive.java:</code><code class="java value">282</code><code class="java plain">)</code></div><div class="line number6 index5 alt1"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Composite.write(Composite.java:</code><code class="java value">916</code><code class="java plain">)</code></div><div class="line number7 index6 alt2"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Traverser.write(Traverser.java:</code><code class="java value">236</code><code class="java plain">)</code></div><div class="line number8 index7 alt1"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Traverser.write(Traverser.java:</code><code class="java value">208</code><code class="java plain">)</code></div><div class="line number9 index8 alt2"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Traverser.write(Traverser.java:</code><code class="java value">186</code><code class="java plain">)</code></div><div class="line number10 index9 alt1"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Persister.write(Persister.java:</code><code class="java value">1187</code><code class="java plain">)</code></div><div class="line number11 index10 alt2"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Persister.write(Persister.java:</code><code class="java value">1169</code><code class="java plain">)</code></div><div class="line number12 index11 alt1"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Persister.write(Persister.java:</code><code class="java value">1147</code><code class="java plain">)</code></div><div class="line number13 index12 alt2"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Persister.write(Persister.java:</code><code class="java value">1266</code><code class="java plain">)</code></div><div class="line number14 index13 alt1"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Persister.write(Persister.java:</code><code class="java value">1248</code><code class="java plain">)</code></div><div class="line number15 index14 alt2"><code class="java spaces">&nbsp;</code><code class="java plain">at org.simpleframework.xml.core.Persister.write(Persister.java:</code><code class="java value">1229</code><code class="java plain">)</code></div><div class="line number16 index15 alt1"><code class="java spaces">&nbsp;</code><code class="java plain">at comparison.simplexml.SimpleXMLDemo.main(SimpleXMLDemo.java:</code><code class="java value">12</code><code class="java plain">)</code></div></div></td></tr></tbody></table></div></div><div style="font-family: Arial,Helvetica,sans-serif;"><br>
</div><div style="font-family: Arial,Helvetica,sans-serif;">We can enable Simple to apply default mappping rules by using the @Default annotation:</div><br>
<div><div id="highlighter_729310" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2 highlighted">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div><div class="line number18 index17 alt1">18</div><div class="line number19 index18 alt2">19</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">java.util.ArrayList;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">java.util.List;</code></div><div class="line number5 index4 alt2"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Default;</code></div><div class="line number6 index5 alt1">&nbsp;</div><div class="line number7 index6 alt2 highlighted"><code class="java color1">@Default</code></div><div class="line number8 index7 alt1"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Customer {</code></div><div class="line number9 index8 alt2">&nbsp;</div><div class="line number10 index9 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java keyword">long</code> <code class="java plain">id;</code></div><div class="line number11 index10 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String name;</code></div><div class="line number12 index11 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">Address address;</code></div><div class="line number13 index12 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">List&lt;PhoneNumber&gt; phoneNumbers;</code></div><div class="line number14 index13 alt1">&nbsp;</div><div class="line number15 index14 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">public</code> <code class="java plain">Customer() {</code></div><div class="line number16 index15 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">phoneNumbers = </code><code class="java keyword">new</code> <code class="java plain">ArrayList&lt;PhoneNumber&gt;();</code></div><div class="line number17 index16 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">}</code></div><div class="line number18 index17 alt1">&nbsp;</div><div class="line number19 index18 alt2"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<div><div id="highlighter_633957" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2 highlighted">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Default;</code></div><div class="line number4 index3 alt1">&nbsp;</div><div class="line number5 index4 alt2 highlighted"><code class="java color1">@Default</code></div><div class="line number6 index5 alt1"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Address {</code></div><div class="line number7 index6 alt2">&nbsp;</div><div class="line number8 index7 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String city;</code></div><div class="line number9 index8 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String street;</code></div><div class="line number10 index9 alt1">&nbsp;</div><div class="line number11 index10 alt2"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<div><div id="highlighter_258523" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2 highlighted">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Default;</code></div><div class="line number4 index3 alt1">&nbsp;</div><div class="line number5 index4 alt2 highlighted"><code class="java color1">@Default</code></div><div class="line number6 index5 alt1"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">PhoneNumber {</code></div><div class="line number7 index6 alt2">&nbsp;</div><div class="line number8 index7 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String type;</code></div><div class="line number9 index8 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String number;</code></div><div class="line number10 index9 alt1">&nbsp;</div><div class="line number11 index10 alt2"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<div style="font-family: Arial,Helvetica,sans-serif;">Now Simple will produce the following XML:</div><br>
<div><div id="highlighter_703301" class="syntaxhighlighter  xml"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div><div class="line number18 index17 alt1">18</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">customer</code><code class="xml plain">&gt;</code></div><div class="line number2 index1 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">id</code><code class="xml plain">&gt;123&lt;/</code><code class="xml keyword">id</code><code class="xml plain">&gt;</code></div><div class="line number3 index2 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">name</code><code class="xml plain">&gt;Jane Doe&lt;/</code><code class="xml keyword">name</code><code class="xml plain">&gt;</code></div><div class="line number4 index3 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number5 index4 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">city</code><code class="xml plain">&gt;Any Town&lt;/</code><code class="xml keyword">city</code><code class="xml plain">&gt;</code></div><div class="line number6 index5 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">street</code><code class="xml plain">&gt;1 A Street&lt;/</code><code class="xml keyword">street</code><code class="xml plain">&gt;</code></div><div class="line number7 index6 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number8 index7 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phoneNumbers</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"java.util.ArrayList"</code><code class="xml plain">&gt;</code></div><div class="line number9 index8 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phoneNumber</code><code class="xml plain">&gt;</code></div><div class="line number10 index9 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">type</code><code class="xml plain">&gt;work&lt;/</code><code class="xml keyword">type</code><code class="xml plain">&gt;</code></div><div class="line number11 index10 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">number</code><code class="xml plain">&gt;555-WORK&lt;/</code><code class="xml keyword">number</code><code class="xml plain">&gt;</code></div><div class="line number12 index11 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">phoneNumber</code><code class="xml plain">&gt;</code></div><div class="line number13 index12 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phoneNumber</code><code class="xml plain">&gt;</code></div><div class="line number14 index13 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">type</code><code class="xml plain">&gt;cell&lt;/</code><code class="xml keyword">type</code><code class="xml plain">&gt;</code></div><div class="line number15 index14 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">number</code><code class="xml plain">&gt;555-CELL&lt;/</code><code class="xml keyword">number</code><code class="xml plain">&gt;</code></div><div class="line number16 index15 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">phoneNumber</code><code class="xml plain">&gt;</code></div><div class="line number17 index16 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">phoneNumbers</code><code class="xml plain">&gt;</code></div><div class="line number18 index17 alt1"><code class="xml plain">&lt;/</code><code class="xml keyword">customer</code><code class="xml plain">&gt;</code></div></div></td></tr></tbody></table></div></div><br>
</div><div class="brush: java; toolbar: false"><span style="font-family: Arial,Helvetica,sans-serif;"><b>JAXB</b></span><br>
<br>
<span style="font-family: Arial;">JAXB produces the following XML.&nbsp; The representation is straight forward and more compact than the Simple representation.</span></div><br>
<div><div id="highlighter_999236" class="syntaxhighlighter  xml"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">customer</code><code class="xml plain">&gt;</code></div><div class="line number2 index1 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">id</code><code class="xml plain">&gt;123&lt;/</code><code class="xml keyword">id</code><code class="xml plain">&gt;</code></div><div class="line number3 index2 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number4 index3 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">city</code><code class="xml plain">&gt;Any Town&lt;/</code><code class="xml keyword">city</code><code class="xml plain">&gt;</code></div><div class="line number5 index4 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">street</code><code class="xml plain">&gt;1 A Street&lt;/</code><code class="xml keyword">street</code><code class="xml plain">&gt;</code></div><div class="line number6 index5 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number7 index6 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">name</code><code class="xml plain">&gt;Jane Doe&lt;/</code><code class="xml keyword">name</code><code class="xml plain">&gt;</code></div><div class="line number8 index7 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phoneNumbers</code><code class="xml plain">&gt;</code></div><div class="line number9 index8 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">number</code><code class="xml plain">&gt;555-WORK&lt;/</code><code class="xml keyword">number</code><code class="xml plain">&gt;</code></div><div class="line number10 index9 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">type</code><code class="xml plain">&gt;work&lt;/</code><code class="xml keyword">type</code><code class="xml plain">&gt;</code></div><div class="line number11 index10 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">phoneNumbers</code><code class="xml plain">&gt;</code></div><div class="line number12 index11 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phoneNumbers</code><code class="xml plain">&gt;</code></div><div class="line number13 index12 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">number</code><code class="xml plain">&gt;555-CELL&lt;/</code><code class="xml keyword">number</code><code class="xml plain">&gt;</code></div><div class="line number14 index13 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">type</code><code class="xml plain">&gt;cell&lt;/</code><code class="xml keyword">type</code><code class="xml plain">&gt;</code></div><div class="line number15 index14 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">phoneNumbers</code><code class="xml plain">&gt;</code></div><div class="line number16 index15 alt1"><code class="xml plain">&lt;/</code><code class="xml keyword">customer</code><code class="xml plain">&gt;</code></div></div></td></tr></tbody></table></div></div><div class="brush: xml; toolbar: false"><br>
<span style="font-family: Arial,Helvetica,sans-serif; font-size: large;"><b>Field Access</b></span></div><div class="brush: xml; toolbar: false"><br>
<span style="font-family: Arial,Helvetica,sans-serif;">For this example we will configure our XML binding tools to interact directly with the fields (instance variables).</span><br>
<br>
<b><span style="font-family: Arial;">Simple</span></b></div><div class="brush: xml; toolbar: false"><br>
</div><div class="brush: xml; toolbar: false"><span style="font-family: Arial;">Simple&nbsp;uses field access by default.</span></div><div class="brush: xml; toolbar: false"><br>
</div><div class="brush: xml; toolbar: false"><b><span style="font-family: Arial;">JAXB</span></b></div><div class="brush: xml; toolbar: false"><br>
</div><div class="brush: xml; toolbar: false"><span style="font-family: Arial;">By default JAXB will access public fields and properties.&nbsp; We can configure JAXB to use field access with the following package level annotation:</span></div><div class="brush: xml; toolbar: false"><br>
</div><div><div id="highlighter_702136" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2 highlighted">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2 highlighted"><code class="java color1">@XmlAccessorType</code><code class="java plain">(XmlAccessType.FIELD)</code></div><div class="line number2 index1 alt1"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number3 index2 alt2">&nbsp;</div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlAccessType;</code></div><div class="line number5 index4 alt2"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlAccessorType;</code></div></div></td></tr></tbody></table></div></div><br>
<div class="brush: xml; toolbar: false"><span style="font-family: Arial,Helvetica,sans-serif; font-size: large;"><b>Renaming Elements</b></span></div><div class="brush: xml; toolbar: false"><br>
</div><div class="brush: xml; toolbar: false"><span style="font-family: Arial;">Next we will look at how to tweak the XML output using the appropriate mapping metadata.&nbsp; First we will rename some elements.&nbsp; As you will see the amount of configuration required is almost identical.</span></div><div class="brush: xml; toolbar: false"><br>
</div><div class="brush: xml; toolbar: false"><span style="font-family: Arial;"><b>Simple</b></span><br>
<br>
<span style="font-family: Arial;">For Simple the default root element is already what we want.&nbsp; We will use @ElementList to configure the phoneNumbers property.</span><br>
<br>
</div><div><div id="highlighter_368220" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div><div class="line number18 index17 alt1 highlighted">18</div><div class="line number19 index18 alt2">19</div><div class="line number20 index19 alt1">20</div><div class="line number21 index20 alt2">21</div><div class="line number22 index21 alt1">22</div><div class="line number23 index22 alt2">23</div><div class="line number24 index23 alt1">24</div><div class="line number25 index24 alt2">25</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">java.util.ArrayList;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">java.util.List;</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Default;</code></div><div class="line number7 index6 alt2"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.ElementList;</code></div><div class="line number8 index7 alt1">&nbsp;</div><div class="line number9 index8 alt2"><code class="java color1">@Default</code></div><div class="line number10 index9 alt1"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Customer {</code></div><div class="line number11 index10 alt2">&nbsp;</div><div class="line number12 index11 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java keyword">long</code> <code class="java plain">id;</code></div><div class="line number13 index12 alt2">&nbsp;</div><div class="line number14 index13 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String name;</code></div><div class="line number15 index14 alt2">&nbsp;</div><div class="line number16 index15 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">Address address;</code></div><div class="line number17 index16 alt2">&nbsp;</div><div class="line number18 index17 alt1 highlighted"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@ElementList</code><code class="java plain">(inline=</code><code class="java keyword">true</code><code class="java plain">, entry=</code><code class="java string">"phone-number"</code><code class="java plain">)</code></div><div class="line number19 index18 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">List&lt;PhoneNumber&gt; phoneNumbers;</code></div><div class="line number20 index19 alt1">&nbsp;</div><div class="line number21 index20 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">public</code> <code class="java plain">Customer() {</code></div><div class="line number22 index21 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">phoneNumbers = </code><code class="java keyword">new</code> <code class="java plain">ArrayList&lt;PhoneNumber&gt;();</code></div><div class="line number23 index22 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">}</code></div><div class="line number24 index23 alt1">&nbsp;</div><div class="line number25 index24 alt2"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<div class="brush: xml; toolbar: false"><span style="font-family: Arial;"><b>JAXB</b></span><br>
<br>
<span style="font-family: Arial;">For&nbsp;JAXB we will use @XmlRootElement to configure the root element, and @XmlElement to configure the phoneNumbers property.</span></div><div><div id="highlighter_694278" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2 highlighted">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1 highlighted">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div><div class="line number18 index17 alt1">18</div><div class="line number19 index18 alt2">19</div><div class="line number20 index19 alt1">20</div><div class="line number21 index20 alt2">21</div><div class="line number22 index21 alt1">22</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">import</code> <code class="java plain">java.util.ArrayList;</code></div><div class="line number2 index1 alt1"><code class="java keyword">import</code> <code class="java plain">java.util.List;</code></div><div class="line number3 index2 alt2">&nbsp;</div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlElement;</code></div><div class="line number5 index4 alt2"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlRootElement;</code></div><div class="line number6 index5 alt1">&nbsp;</div><div class="line number7 index6 alt2 highlighted"><code class="java color1">@XmlRootElement</code></div><div class="line number8 index7 alt1"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Customer {</code></div><div class="line number9 index8 alt2">&nbsp;</div><div class="line number10 index9 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java keyword">long</code> <code class="java plain">id;</code></div><div class="line number11 index10 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String name;</code></div><div class="line number12 index11 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">Address address;</code></div><div class="line number13 index12 alt2">&nbsp;</div><div class="line number14 index13 alt1 highlighted"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@XmlElement</code><code class="java plain">(name=</code><code class="java string">"phone-number"</code><code class="java plain">)</code></div><div class="line number15 index14 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">List&lt;phonenumber&gt; phoneNumbers;</code></div><div class="line number16 index15 alt1">&nbsp;</div><div class="line number17 index16 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">public</code> <code class="java plain">Customer() {</code></div><div class="line number18 index17 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">phoneNumbers = </code><code class="java keyword">new</code> <code class="java plain">ArrayList&lt;phonenumber&gt;();</code></div><div class="line number19 index18 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">}</code></div><div class="line number20 index19 alt1">&nbsp;</div><div class="line number21 index20 alt2"><code class="java plain">}</code></div><div class="line number22 index21 alt1"><code class="java plain">&lt;/phonenumber&gt;&lt;/phonenumber&gt;</code></div></div></td></tr></tbody></table></div></div><br>
<span style="font-family: Arial,Helvetica,sans-serif;">Note:&nbsp; The JAXB Marshal code can now be simplified since we no longer need to supply the root element information:</span><br>
<br>
<div><div id="highlighter_268857" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div><div class="line number18 index17 alt1">18</div><div class="line number19 index18 alt2">19</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison.jaxb;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.JAXBContext;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.Marshaller;</code></div><div class="line number5 index4 alt2"><code class="java keyword">import</code> <code class="java plain">comparison.Customer;</code></div><div class="line number6 index5 alt1">&nbsp;</div><div class="line number7 index6 alt2"><code class="java keyword">import</code> <code class="java keyword">static</code> <code class="java plain">comparison.Data.CUSTOMER;</code></div><div class="line number8 index7 alt1">&nbsp;</div><div class="line number9 index8 alt2"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">JAXBDemo {</code></div><div class="line number10 index9 alt1">&nbsp;</div><div class="line number11 index10 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">public</code> <code class="java keyword">static</code> <code class="java keyword">void</code> <code class="java plain">main(String[] args) </code><code class="java keyword">throws</code> <code class="java plain">Exception {</code></div><div class="line number12 index11 alt1">&nbsp;</div><div class="line number13 index12 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">JAXBContext jc = JAXBContext.newInstance(Customer.</code><code class="java keyword">class</code><code class="java plain">);</code></div><div class="line number14 index13 alt1">&nbsp;</div><div class="line number15 index14 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">Marshaller marshaller = jc.createMarshaller();</code></div><div class="line number16 index15 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, </code><code class="java keyword">true</code><code class="java plain">);</code></div><div class="line number17 index16 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">marshaller.marshal(CUSTOMER, System.out);</code></div><div class="line number18 index17 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">}</code></div><div class="line number19 index18 alt2"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<span style="font-family: Arial,Helvetica,sans-serif;"><b>XML Output</b></span><br>
<br>
<span style="font-family: Arial;">At this point the same XML is being produced by Simple and JAXB.</span><br>
<br>
<div><div id="highlighter_487521" class="syntaxhighlighter  xml"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2 highlighted">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1 highlighted">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1 highlighted">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2 highlighted"><code class="xml plain">&lt;</code><code class="xml keyword">customer</code><code class="xml plain">&gt;</code></div><div class="line number2 index1 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">id</code><code class="xml plain">&gt;123&lt;/</code><code class="xml keyword">id</code><code class="xml plain">&gt;</code></div><div class="line number3 index2 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">name</code><code class="xml plain">&gt;Jane Doe&lt;/</code><code class="xml keyword">name</code><code class="xml plain">&gt;</code></div><div class="line number4 index3 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number5 index4 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">city</code><code class="xml plain">&gt;Any Town&lt;/</code><code class="xml keyword">city</code><code class="xml plain">&gt;</code></div><div class="line number6 index5 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">street</code><code class="xml plain">&gt;1 A Street&lt;/</code><code class="xml keyword">street</code><code class="xml plain">&gt;</code></div><div class="line number7 index6 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number8 index7 alt1 highlighted"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number9 index8 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">type</code><code class="xml plain">&gt;work&lt;/</code><code class="xml keyword">type</code><code class="xml plain">&gt;</code></div><div class="line number10 index9 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">number</code><code class="xml plain">&gt;555-WORK&lt;/</code><code class="xml keyword">number</code><code class="xml plain">&gt;</code></div><div class="line number11 index10 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number12 index11 alt1 highlighted"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number13 index12 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">type</code><code class="xml plain">&gt;cell&lt;/</code><code class="xml keyword">type</code><code class="xml plain">&gt;</code></div><div class="line number14 index13 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">number</code><code class="xml plain">&gt;555-CELL&lt;/</code><code class="xml keyword">number</code><code class="xml plain">&gt;</code></div><div class="line number15 index14 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number16 index15 alt1"><code class="xml plain">&lt;/</code><code class="xml keyword">customer</code><code class="xml plain">&gt;</code></div></div></td></tr></tbody></table></div></div><div class="brush: xml; toolbar: false"><br>
<span style="font-family: Arial,Helvetica,sans-serif; font-size: large;"><b>Change the Order of Elements</b></span><br>
<br>
<span style="font-family: Arial,Helvetica,sans-serif;">We will tweak the document again to make sure that when marshalling an Address object the "street" element will always appear before the "city" element.</span><br>
<br>
<span style="font-family: Arial,Helvetica,sans-serif;"><b>Simple</b></span><br>
<br>
<span style="font-family: Arial;">For Simple we will use @Order to configure the ordering of elements:</span><br>
<br>
<div><div id="highlighter_487607" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1 highlighted">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Default;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Order;</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1 highlighted"><code class="java color1">@Order</code><code class="java plain">(elements={</code><code class="java string">"street"</code><code class="java plain">, </code><code class="java string">"city"</code><code class="java plain">})</code></div><div class="line number7 index6 alt2"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Address {</code></div><div class="line number8 index7 alt1">&nbsp;</div><div class="line number9 index8 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String city;</code></div><div class="line number10 index9 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String street;</code></div><div class="line number11 index10 alt2">&nbsp;</div><div class="line number12 index11 alt1"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<span style="font-family: Arial,Helvetica,sans-serif;"><b>JAXB</b></span><br>
<br>
<span style="font-family: Arial;">For&nbsp;JAXB we will use @XmlType to configure the ordering of elements.</span><br>
<br>
<div><div id="highlighter_104899" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2 highlighted">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlType;</code></div><div class="line number4 index3 alt1">&nbsp;</div><div class="line number5 index4 alt2 highlighted"><code class="java color1">@XmlType</code><code class="java plain">(propOrder={</code><code class="java string">"street"</code><code class="java plain">, </code><code class="java string">"city"</code><code class="java plain">})</code></div><div class="line number6 index5 alt1"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Address {</code></div><div class="line number7 index6 alt2">&nbsp;</div><div class="line number8 index7 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String city;</code></div><div class="line number9 index8 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String street;</code></div><div class="line number10 index9 alt1">&nbsp;</div><div class="line number11 index10 alt2"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<span style="font-family: Arial,Helvetica,sans-serif;"><b>XML Output</b></span><br>
<br>
<span style="font-family: Arial,Helvetica,sans-serif;">The XML output&nbsp;is the same for both JAXB and Simple.</span><br>
<br>
<div><div id="highlighter_715719" class="syntaxhighlighter  xml"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2 highlighted">5</div><div class="line number6 index5 alt1 highlighted">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">customer</code><code class="xml plain">&gt;</code></div><div class="line number2 index1 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">id</code><code class="xml plain">&gt;123&lt;/</code><code class="xml keyword">id</code><code class="xml plain">&gt;</code></div><div class="line number3 index2 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">name</code><code class="xml plain">&gt;Jane Doe&lt;/</code><code class="xml keyword">name</code><code class="xml plain">&gt;</code></div><div class="line number4 index3 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number5 index4 alt2 highlighted"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">street</code><code class="xml plain">&gt;1 A Street&lt;/</code><code class="xml keyword">street</code><code class="xml plain">&gt;</code></div><div class="line number6 index5 alt1 highlighted"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">city</code><code class="xml plain">&gt;Any Town&lt;/</code><code class="xml keyword">city</code><code class="xml plain">&gt;</code></div><div class="line number7 index6 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number8 index7 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number9 index8 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">type</code><code class="xml plain">&gt;work&lt;/</code><code class="xml keyword">type</code><code class="xml plain">&gt;</code></div><div class="line number10 index9 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">number</code><code class="xml plain">&gt;555-WORK&lt;/</code><code class="xml keyword">number</code><code class="xml plain">&gt;</code></div><div class="line number11 index10 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number12 index11 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number13 index12 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">type</code><code class="xml plain">&gt;cell&lt;/</code><code class="xml keyword">type</code><code class="xml plain">&gt;</code></div><div class="line number14 index13 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">number</code><code class="xml plain">&gt;555-CELL&lt;/</code><code class="xml keyword">number</code><code class="xml plain">&gt;</code></div><div class="line number15 index14 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number16 index15 alt1"><code class="xml plain">&lt;/</code><code class="xml keyword">customer</code><code class="xml plain">&gt;</code></div></div></td></tr></tbody></table></div></div><br>
<span style="font-family: Arial,Helvetica,sans-serif; font-size: large;"><b>Mapping to an Attribute</b></span></div><div class="brush: xml; toolbar: false"><br>
<span style="font-family: Arial;">Now&nbsp;we will look at how to tweak the XML output using the appropriate mapping metadata to produce XML attributes.&nbsp; As you will see the amount of configuration required is almost identical.</span></div><div class="brush: xml; toolbar: false"><br>
<span style="font-family: Arial,Helvetica,sans-serif;"><b>Simple</b></span></div><div class="brush: xml; toolbar: false"><br>
</div><div class="brush: xml; toolbar: false"><span style="font-family: Arial;">For Simple we will use @Attribute to configure the id property to be represented as an XML attribute.</span></div><div class="brush: xml; toolbar: false"><br>
</div><div><div id="highlighter_397279" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2 highlighted">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div><div class="line number18 index17 alt1">18</div><div class="line number19 index18 alt2">19</div><div class="line number20 index19 alt1">20</div><div class="line number21 index20 alt2">21</div><div class="line number22 index21 alt1">22</div><div class="line number23 index22 alt2">23</div><div class="line number24 index23 alt1">24</div><div class="line number25 index24 alt2">25</div><div class="line number26 index25 alt1">26</div><div class="line number27 index26 alt2">27</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">java.util.ArrayList;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">java.util.List;</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Attribute;</code></div><div class="line number7 index6 alt2"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Default;</code></div><div class="line number8 index7 alt1"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.ElementList;</code></div><div class="line number9 index8 alt2">&nbsp;</div><div class="line number10 index9 alt1"><code class="java color1">@Default</code></div><div class="line number11 index10 alt2"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Customer {</code></div><div class="line number12 index11 alt1">&nbsp;</div><div class="line number13 index12 alt2 highlighted"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@Attribute</code></div><div class="line number14 index13 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java keyword">long</code> <code class="java plain">id;</code></div><div class="line number15 index14 alt2">&nbsp;</div><div class="line number16 index15 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String name;</code></div><div class="line number17 index16 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">Address address;</code></div><div class="line number18 index17 alt1">&nbsp;</div><div class="line number19 index18 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@ElementList</code><code class="java plain">(inline=</code><code class="java keyword">true</code><code class="java plain">, entry=</code><code class="java string">"phone-number"</code><code class="java plain">)</code></div><div class="line number20 index19 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">List&lt;phonenumber&gt; phoneNumbers;</code></div><div class="line number21 index20 alt2">&nbsp;</div><div class="line number22 index21 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">public</code> <code class="java plain">Customer() {</code></div><div class="line number23 index22 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">phoneNumbers = </code><code class="java keyword">new</code> <code class="java plain">ArrayList&lt;phonenumber&gt;();</code></div><div class="line number24 index23 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">}</code></div><div class="line number25 index24 alt2">&nbsp;</div><div class="line number26 index25 alt1"><code class="java plain">}</code></div><div class="line number27 index26 alt2"><code class="java plain">&lt;/phonenumber&gt;&lt;/phonenumber&gt;</code></div></div></td></tr></tbody></table></div></div><div class="brush: xml; toolbar: false"><br>
<span style="font-family: Arial,Helvetica,sans-serif;"><b>JAXB</b></span></div><div class="brush: xml; toolbar: false"><br>
</div><div class="brush: xml; toolbar: false"><span style="font-family: Arial;">For&nbsp;JAXB we will use @XmlAttribute to configure the id property to be represented as an XML attribute.</span></div><div><div id="highlighter_849866" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2 highlighted">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div><div class="line number18 index17 alt1">18</div><div class="line number19 index18 alt2">19</div><div class="line number20 index19 alt1">20</div><div class="line number21 index20 alt2">21</div><div class="line number22 index21 alt1">22</div><div class="line number23 index22 alt2">23</div><div class="line number24 index23 alt1">24</div><div class="line number25 index24 alt2">25</div><div class="line number26 index25 alt1">26</div><div class="line number27 index26 alt2">27</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">java.util.ArrayList;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">java.util.List;</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlAttribute;</code></div><div class="line number7 index6 alt2"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlElement;</code></div><div class="line number8 index7 alt1"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlRootElement;</code></div><div class="line number9 index8 alt2">&nbsp;</div><div class="line number10 index9 alt1"><code class="java color1">@XmlRootElement</code></div><div class="line number11 index10 alt2"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Customer {</code></div><div class="line number12 index11 alt1">&nbsp;</div><div class="line number13 index12 alt2 highlighted"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@XmlAttribute</code></div><div class="line number14 index13 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java keyword">long</code> <code class="java plain">id;</code></div><div class="line number15 index14 alt2">&nbsp;</div><div class="line number16 index15 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String name;</code></div><div class="line number17 index16 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">Address address;</code></div><div class="line number18 index17 alt1">&nbsp;</div><div class="line number19 index18 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@XmlElement</code><code class="java plain">(name=</code><code class="java string">"phone-number"</code><code class="java plain">)</code></div><div class="line number20 index19 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">List&lt;phonenumber&gt; phoneNumbers;</code></div><div class="line number21 index20 alt2">&nbsp;</div><div class="line number22 index21 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">public</code> <code class="java plain">Customer() {</code></div><div class="line number23 index22 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">phoneNumbers = </code><code class="java keyword">new</code> <code class="java plain">ArrayList&lt;phonenumber&gt;();</code></div><div class="line number24 index23 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">}</code></div><div class="line number25 index24 alt2">&nbsp;</div><div class="line number26 index25 alt1"><code class="java plain">}</code></div><div class="line number27 index26 alt2"><code class="java plain">&lt;/phonenumber&gt;&lt;/phonenumber&gt;</code></div></div></td></tr></tbody></table></div></div><div class="brush: java; toolbar: false; highlight: [13]"><br>
<b><span style="font-family: Arial,Helvetica,sans-serif;">XML Output</span></b></div><div class="brush: java; toolbar: false; highlight: [13]"><br>
</div><div class="brush: java; toolbar: false; highlight: [13]"><span style="font-family: Arial,Helvetica,sans-serif;">The XML output&nbsp;is the same for both JAXB and Simple.</span></div><div><div id="highlighter_306445" class="syntaxhighlighter  xml"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2 highlighted">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2 highlighted"><code class="xml plain">&lt;</code><code class="xml keyword">customer</code> <code class="xml color1">id</code><code class="xml plain">=</code><code class="xml string">"123"</code><code class="xml plain">&gt;</code></div><div class="line number2 index1 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">name</code><code class="xml plain">&gt;Jane Doe&lt;/</code><code class="xml keyword">name</code><code class="xml plain">&gt;</code></div><div class="line number3 index2 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number4 index3 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">city</code><code class="xml plain">&gt;Any Town&lt;/</code><code class="xml keyword">city</code><code class="xml plain">&gt;</code></div><div class="line number5 index4 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">street</code><code class="xml plain">&gt;1 A Street&lt;/</code><code class="xml keyword">street</code><code class="xml plain">&gt;</code></div><div class="line number6 index5 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number7 index6 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number8 index7 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">type</code><code class="xml plain">&gt;work&lt;/</code><code class="xml keyword">type</code><code class="xml plain">&gt;</code></div><div class="line number9 index8 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">number</code><code class="xml plain">&gt;555-WORK&lt;/</code><code class="xml keyword">number</code><code class="xml plain">&gt;</code></div><div class="line number10 index9 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number11 index10 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number12 index11 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">type</code><code class="xml plain">&gt;cell&lt;/</code><code class="xml keyword">type</code><code class="xml plain">&gt;</code></div><div class="line number13 index12 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">number</code><code class="xml plain">&gt;555-CELL&lt;/</code><code class="xml keyword">number</code><code class="xml plain">&gt;</code></div><div class="line number14 index13 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number15 index14 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">customer</code><code class="xml plain">&gt;</code></div></div></td></tr></tbody></table></div></div><div class="brush: xml; toolbar: false"><br>
</div><div class="brush: xml; toolbar: false"><span style="font-family: Arial,Helvetica,sans-serif; font-size: large;"><b>Mapping Objects to Simple Content</b></span></div><div class="brush: xml; toolbar: false"><br>
</div><div class="brush: xml; toolbar: false"><span style="font-family: Arial;">To compact our document even further we will map the PhoneNumber class to a complex type with simple content.</span></div><div class="brush: xml; toolbar: false"><br>
</div><div class="brush: xml; toolbar: false"><span style="font-family: Arial,Helvetica,sans-serif;"><b>Simple</b></span></div><div class="brush: xml; toolbar: false"><br>
</div><div class="brush: xml; toolbar: false"><span style="font-family: Arial;">With Simple we will use the @Attribute and @Text annotations on the PhoneNumber class.</span><br>
<br>
<div><div id="highlighter_930461" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1 highlighted">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2 highlighted">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Attribute;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Default;</code></div><div class="line number5 index4 alt2"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Text;</code></div><div class="line number6 index5 alt1">&nbsp;</div><div class="line number7 index6 alt2"><code class="java color1">@Default</code></div><div class="line number8 index7 alt1"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">PhoneNumber {</code></div><div class="line number9 index8 alt2">&nbsp;</div><div class="line number10 index9 alt1 highlighted"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@Attribute</code></div><div class="line number11 index10 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String type;</code></div><div class="line number12 index11 alt1">&nbsp;</div><div class="line number13 index12 alt2 highlighted"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@Text</code></div><div class="line number14 index13 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String number;</code></div><div class="line number15 index14 alt2">&nbsp;</div><div class="line number16 index15 alt1"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div></div><span style="font-family: Arial,Helvetica,sans-serif;"><b>JAXB</b></span><br>
<br>
<span style="font-family: Arial,Helvetica,sans-serif;">For JAXB we will use the @XmlAttribute and @XmlValue annotations on the PhoneNumber class.</span><br>
<br>
<div><div id="highlighter_412513" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1 highlighted">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2 highlighted">11</div><div class="line number12 index11 alt1">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlAttribute;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlValue;</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">PhoneNumber {</code></div><div class="line number7 index6 alt2">&nbsp;</div><div class="line number8 index7 alt1 highlighted"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@XmlAttribute</code></div><div class="line number9 index8 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String type;</code></div><div class="line number10 index9 alt1">&nbsp;</div><div class="line number11 index10 alt2 highlighted"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@XmlValue</code></div><div class="line number12 index11 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String number;</code></div><div class="line number13 index12 alt2">&nbsp;</div><div class="line number14 index13 alt1"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><br>
<span style="font-family: Arial,Helvetica,sans-serif;"><b>XML Output:</b></span><br>
<br>
<span style="font-family: Arial;">The XML output&nbsp;is the same for both JAXB and Simple.</span><br>
<br>
<div><div id="highlighter_398311" class="syntaxhighlighter  xml"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2 highlighted">7</div><div class="line number8 index7 alt1 highlighted">8</div><div class="line number9 index8 alt2">9</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">customer</code> <code class="xml color1">id</code><code class="xml plain">=</code><code class="xml string">"123"</code><code class="xml plain">&gt;</code></div><div class="line number2 index1 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">name</code><code class="xml plain">&gt;Jane Doe&lt;/</code><code class="xml keyword">name</code><code class="xml plain">&gt;</code></div><div class="line number3 index2 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number4 index3 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">street</code><code class="xml plain">&gt;1 A Street&lt;/</code><code class="xml keyword">street</code><code class="xml plain">&gt;</code></div><div class="line number5 index4 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">city</code><code class="xml plain">&gt;Any Town&lt;/</code><code class="xml keyword">city</code><code class="xml plain">&gt;</code></div><div class="line number6 index5 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number7 index6 alt2 highlighted"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phone-number</code> <code class="xml color1">type</code><code class="xml plain">=</code><code class="xml string">"work"</code><code class="xml plain">&gt;555-WORK&lt;/</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number8 index7 alt1 highlighted"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phone-number</code> <code class="xml color1">type</code><code class="xml plain">=</code><code class="xml string">"cell"</code><code class="xml plain">&gt;555-CELL&lt;/</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number9 index8 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">customer</code><code class="xml plain">&gt;</code></div></div></td></tr></tbody></table></div></div><br>
<div class="brush: xml; toolbar: false"><b><span style="font-family: Arial,Helvetica,sans-serif; font-size: large;">Applying Namespaces</span></b></div><div class="brush: xml; toolbar: false"><br>
<span style="font-family: Arial,Helvetica,sans-serif;">We will now namespace qualify the XML document.</span></div><br>
<div class="brush: xml; toolbar: false"><span style="font-family: Arial;"><b>Simple</b></span></div><div class="brush: xml; toolbar: false"><br>
<span style="font-family: Arial,Helvetica,sans-serif;">We will use the @Namespace annotation to specify a namespace for the document.&nbsp; This may just be an issue of personal preference, but I do not like metadata on the Customer class affecting the namespace qualification on the Address and PhoneNumber classes.</span></div><br>
<div><div id="highlighter_190272" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div><div class="line number10 index9 alt1">10</div><div class="line number11 index10 alt2">11</div><div class="line number12 index11 alt1 highlighted">12</div><div class="line number13 index12 alt2">13</div><div class="line number14 index13 alt1">14</div><div class="line number15 index14 alt2">15</div><div class="line number16 index15 alt1">16</div><div class="line number17 index16 alt2">17</div><div class="line number18 index17 alt1">18</div><div class="line number19 index18 alt2">19</div><div class="line number20 index19 alt1">20</div><div class="line number21 index20 alt2">21</div><div class="line number22 index21 alt1">22</div><div class="line number23 index22 alt2">23</div><div class="line number24 index23 alt1">24</div><div class="line number25 index24 alt2">25</div><div class="line number26 index25 alt1">26</div><div class="line number27 index26 alt2">27</div><div class="line number28 index27 alt1">28</div><div class="line number29 index28 alt2">29</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number2 index1 alt1">&nbsp;</div><div class="line number3 index2 alt2"><code class="java keyword">import</code> <code class="java plain">java.util.ArrayList;</code></div><div class="line number4 index3 alt1"><code class="java keyword">import</code> <code class="java plain">java.util.List;</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Attribute;</code></div><div class="line number7 index6 alt2"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Default;</code></div><div class="line number8 index7 alt1"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.ElementList;</code></div><div class="line number9 index8 alt2"><code class="java keyword">import</code> <code class="java plain">org.simpleframework.xml.Namespace;</code></div><div class="line number10 index9 alt1">&nbsp;</div><div class="line number11 index10 alt2"><code class="java color1">@Default</code></div><div class="line number12 index11 alt1 highlighted"><code class="java color1">@Namespace</code><code class="java plain">(reference=</code><code class="java string">"<a href="http://www.example.com">http://www.example.com</a>"</code><code class="java plain">)</code></div><div class="line number13 index12 alt2"><code class="java keyword">public</code> <code class="java keyword">class</code> <code class="java plain">Customer {</code></div><div class="line number14 index13 alt1">&nbsp;</div><div class="line number15 index14 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@Attribute</code></div><div class="line number16 index15 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java keyword">long</code> <code class="java plain">id;</code></div><div class="line number17 index16 alt2">&nbsp;</div><div class="line number18 index17 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">String name;</code></div><div class="line number19 index18 alt2">&nbsp;</div><div class="line number20 index19 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">Address address;</code></div><div class="line number21 index20 alt2">&nbsp;</div><div class="line number22 index21 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java color1">@ElementList</code><code class="java plain">(inline=</code><code class="java keyword">true</code><code class="java plain">, entry=</code><code class="java string">"phone-number"</code><code class="java plain">)</code></div><div class="line number23 index22 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">private</code> <code class="java plain">List&lt;PhoneNumber&gt; phoneNumbers;</code></div><div class="line number24 index23 alt1">&nbsp;</div><div class="line number25 index24 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java keyword">public</code> <code class="java plain">Customer() {</code></div><div class="line number26 index25 alt1"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">phoneNumbers = </code><code class="java keyword">new</code> <code class="java plain">ArrayList&lt;PhoneNumber&gt;();</code></div><div class="line number27 index26 alt2"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">}</code></div><div class="line number28 index27 alt1">&nbsp;</div><div class="line number29 index28 alt2"><code class="java plain">}</code></div></div></td></tr></tbody></table></div></div><div class="brush: xml; toolbar: false"><br>
<span style="font-family: Arial;"><b>JAXB</b></span><br>
<br>
<span style="font-family: Arial;">We can configure the namespace information using the @XmlSchema package level annotation:</span><br>
<br>
</div><div><div id="highlighter_766431" class="syntaxhighlighter  java"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1 highlighted">2</div><div class="line number3 index2 alt2 highlighted">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="java color1">@XmlAccessorType</code><code class="java plain">(XmlAccessType.FIELD)</code></div><div class="line number2 index1 alt1 highlighted"><code class="java color1">@XmlSchema</code><code class="java plain">(namespace=</code><code class="java string">"<a href="http://www.example.com">http://www.example.com</a>"</code><code class="java plain">, </code></div><div class="line number3 index2 alt2 highlighted"><code class="java spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="java plain">elementFormDefault=XmlNsForm.QUALIFIED)</code></div><div class="line number4 index3 alt1"><code class="java keyword">package</code> <code class="java plain">comparison;</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlAccessType;</code></div><div class="line number7 index6 alt2"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlAccessorType;</code></div><div class="line number8 index7 alt1"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlNsForm;</code></div><div class="line number9 index8 alt2"><code class="java keyword">import</code> <code class="java plain">javax.xml.bind.annotation.XmlSchema;</code></div></div></td></tr></tbody></table></div></div><br>
<span style="font-family: Arial,Helvetica,sans-serif;">The following XML was produced</span><br>
<br>
<div><div id="highlighter_497541" class="syntaxhighlighter  xml"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter"><div class="line number1 index0 alt2 highlighted">1</div><div class="line number2 index1 alt1">2</div><div class="line number3 index2 alt2">3</div><div class="line number4 index3 alt1">4</div><div class="line number5 index4 alt2">5</div><div class="line number6 index5 alt1">6</div><div class="line number7 index6 alt2">7</div><div class="line number8 index7 alt1">8</div><div class="line number9 index8 alt2">9</div></td><td class="code"><div class="container"><div class="line number1 index0 alt2 highlighted"><code class="xml plain">&lt;</code><code class="xml keyword">customer</code> <code class="xml color1">xmlns</code><code class="xml plain">=</code><code class="xml string">"<a href="http://www.example.com">http://www.example.com</a>"</code> <code class="xml color1">id</code><code class="xml plain">=</code><code class="xml string">"123"</code><code class="xml plain">&gt;</code></div><div class="line number2 index1 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">name</code><code class="xml plain">&gt;Jane Doe&lt;/</code><code class="xml keyword">name</code><code class="xml plain">&gt;</code></div><div class="line number3 index2 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number4 index3 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">street</code><code class="xml plain">&gt;1 A Street&lt;/</code><code class="xml keyword">street</code><code class="xml plain">&gt;</code></div><div class="line number5 index4 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">city</code><code class="xml plain">&gt;Any Town&lt;/</code><code class="xml keyword">city</code><code class="xml plain">&gt;</code></div><div class="line number6 index5 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">address</code><code class="xml plain">&gt;</code></div><div class="line number7 index6 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phone-number</code> <code class="xml color1">type</code><code class="xml plain">=</code><code class="xml string">"work"</code><code class="xml plain">&gt;555-WORK&lt;/</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number8 index7 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">phone-number</code> <code class="xml color1">type</code><code class="xml plain">=</code><code class="xml string">"cell"</code><code class="xml plain">&gt;555-CELL&lt;/</code><code class="xml keyword">phone-number</code><code class="xml plain">&gt;</code></div><div class="line number9 index8 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">customer</code><code class="xml plain">&gt;&nbsp;</code></div></div></td></tr></tbody></table></div></div><div class="brush: xml; toolbar: false; highlight: [1]"><span style="font-family: Arial,Helvetica,sans-serif; font-size: large;"><span style="font-size: small;">&nbsp;</span><b><br>
</b></span><br>
<span style="font-family: Arial,Helvetica,sans-serif; font-size: large;"><b>Summary</b></span></div><div class="brush: xml; toolbar: false; highlight: [1]"><br>
<div style="font-family: Arial,Helvetica,sans-serif;">It is easy to do simple things with Simple.&nbsp; As can be seen from this example it is also easy to do simple things with JAXB.&nbsp; I prefer JAXB's version of the annotations, but since I helped design them I will admit my bias.&nbsp; However JAXB does have several advantages:</div><ul style="font-family: Arial,Helvetica,sans-serif;"><li><a href="http://bdoughan.blogspot.com/2010/07/jaxb-xml-binding-standard.html">JAXB is a standard</a> with multiple implementations:&nbsp; <a href="https://jaxb.dev.java.net/">Metro</a>, <a href="http://www.eclipse.org/eclipselink/moxy.php">EclipseLink MOXy</a>, <a href="http://ws.apache.org/jaxme/">JaxMe</a>.</li>
<li>An implementation of JAXB is included in Java SE 6. </li>
<li>JAXB has annotations to cover all the remaining XML Schema concepts. </li>
<li>JAXB is the default Web Service binding layer for JAX-WS and JAX-RS.</li>
</ul><div style="font-family: Arial,Helvetica,sans-serif;"><br>
<b><span style="font-size: large;">Further Reading</span></b></div><div style="font-family: Arial,Helvetica,sans-serif;"><br>
</div><div style="font-family: Arial,Helvetica,sans-serif;">If you enjoyed this post you may also be interested in:</div><ul><li><a href="http://bdoughan.blogspot.com/2010/10/how-does-jaxb-compare-to-xstream.html"><span style="font-family: Arial,Helvetica,sans-serif;">How Does JAXB Compare to XStream?&nbsp;</span></a></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">EclipseLink JAXB (MOXy) </span></li>
<ul><li><span style="font-family: Arial,Helvetica,sans-serif;"><a href="http://bdoughan.blogspot.com/2010/12/extending-jaxb-representing-annotations.html">Extending JAXB - Representing Metadata as XML</a></span></li>
<li><a href="http://bdoughan.blogspot.com/2010/09/xpath-based-mapping-geocode-example.html"><span style="font-family: Arial,Helvetica,sans-serif;">XPath Based Mapping - Geocode Example</span></a></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;"><a href="http://bdoughan.blogspot.com/2011/03/map-to-element-based-on-attribute-value.html">Map to Element based on an Attribute Value with EclipseLink JAXB (MOXy)</a></span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;"><a href="http://bdoughan.blogspot.com/2010/07/jpa-entities-to-xml-bidirectional.html">JPA Entities to XML - Bidirectional Relationships</a>&nbsp; </span></li>
</ul></ul><br>
<ul style="font-family: Arial,Helvetica,sans-serif;"></ul></div>
<script type="text/javascript">
digg_url = 'http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html';
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script><span class="db-wrapper db-clear db-large"><span><span class="db-container db-submit"><span class="db-body db-large"><span class="db-count">0</span><span class="db-copy">diggs</span><a class="db-anchor">digg</a></span></span></span></span>
<div style="clear: both;"></div>
</div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">
Posted by
<span class="fn">Blaise Doughan</span>
</span>
<span class="post-timestamp">
at
<a class="timestamp-link" href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html" rel="bookmark" title="permanent link"><abbr class="published" title="2010-10-25T13:53:00-04:00">1:53 PM</abbr></a>
</span>
<span class="post-comment-link">
</span>
<span class="post-icons">
<span class="item-action">
<a href="http://www.blogger.com/email-post.g?blogID=1710464868724994296&amp;postID=1878841028455754447" title="Email Post">
<img alt="" class="icon-action" src="http://img1.blogblog.com/img/icon18_email.gif" height="13" width="18">
</a>
</span>
<span class="item-control blog-admin pid-1640643438">
<a href="http://www.blogger.com/post-edit.g?blogID=1710464868724994296&amp;postID=1878841028455754447&amp;from=pencil" title="Edit Post">
<img alt="" class="icon-action" src="http://img2.blogblog.com/img/icon18_edit_allbkg.gif" height="18" width="18">
</a>
</span>
</span>
<div class="post-share-buttons goog-inline-block">
<a class="goog-inline-block share-button sb-email" href="http://www.blogger.com/share-post.g?blogID=1710464868724994296&amp;postID=1878841028455754447&amp;target=email" target="_blank" title="Email This">
<span class="share-button-link-text">Email This</span>
</a><a class="goog-inline-block share-button sb-blog" href="http://www.blogger.com/share-post.g?blogID=1710464868724994296&amp;postID=1878841028455754447&amp;target=blog" onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target="_blank" title="BlogThis!">
<span class="share-button-link-text">BlogThis!</span>
</a><a class="goog-inline-block share-button sb-twitter" href="http://www.blogger.com/share-post.g?blogID=1710464868724994296&amp;postID=1878841028455754447&amp;target=twitter" target="_blank" title="Share to Twitter">
<span class="share-button-link-text">Share to Twitter</span>
</a><a class="goog-inline-block share-button sb-facebook" href="http://www.blogger.com/share-post.g?blogID=1710464868724994296&amp;postID=1878841028455754447&amp;target=facebook" onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target="_blank" title="Share to Facebook">
<span class="share-button-link-text">Share to Facebook</span>
</a><a class="goog-inline-block share-button sb-buzz" href="http://www.blogger.com/share-post.g?blogID=1710464868724994296&amp;postID=1878841028455754447&amp;target=buzz" onclick='window.open(this.href, "_blank", "height=415,width=690"); return false;' target="_blank" title="Share to Google Buzz">
<span class="share-button-link-text">Share to Google Buzz</span>
</a><div class="goog-inline-block dummy-container"><div style="height: 20px; width: 90px; display: inline-block; text-indent: 0pt; margin: 0pt; padding: 0pt; background: none repeat scroll 0% 0% transparent; border-style: none; float: none;" id="___plusone_0"><iframe allowtransparency="true" hspace="0" id="I1_1314673464626" marginheight="0" marginwidth="0" name="I1_1314673464626" src="https://plusone.google.com/u/0/_/+1/fastbutton?url=http%3A%2F%2Fblog.bdoughan.com%2F2010%2F10%2Fhow-does-jaxb-compare-to-simple.html&amp;source=blogger&amp;size=medium&amp;count=true&amp;annotation=&amp;hl=en&amp;jsh=r%3Bgc%2F23217085-590ae8cc#id=I1_1314673464626&amp;parent=http%3A%2F%2Fblog.bdoughan.com&amp;rpctoken=535265536&amp;_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe" style="position: static; left: 0pt; top: 0pt; width: 90px; height: 20px; visibility: visible;" tabindex="-1" vspace="0" frameborder="0" scrolling="no" width="100%"></iframe></div></div>
</div>
</div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">
Labels:
<a href="http://blog.bdoughan.com/search/label/Comparison" rel="tag">Comparison</a>,
<a href="http://blog.bdoughan.com/search/label/JAXB" rel="tag">JAXB</a>,
<a href="http://blog.bdoughan.com/search/label/Simple" rel="tag">Simple</a>
</span>
</div>
<div class="post-footer-line post-footer-line-3"><span class="post-location">
</span>
</div>
</div>
</div>
<div class="comments" id="comments">
<a name="comments"></a>
<h4>
17
comments:
        
</h4>
<div id="Blog1_comments-block-wrapper">
<dl class="avatar-comment-indent" id="comments-block">
<dt class="comment-author " id="c7164623565863772295">
<a name="c7164623565863772295"></a>
<div class="avatar-image-container avatar-stock"><span dir="ltr"><a href="http://www.blogger.com/profile/16130632040442519847" rel="nofollow" onclick="" class="avatar-hovercard" id="av-0-16130632040442519847"><img src="http://img2.blogblog.com/img/b16-rounded.gif" alt="" title="tskaufma" height="16" width="16">

</a></span></div>
<a href="http://www.blogger.com/profile/16130632040442519847" rel="nofollow">tskaufma</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-7164623565863772295">
<p>
I find the package level annotations awkward to look at. Is there another way to achieve the same result?
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1288045200101#c7164623565863772295" title="comment permalink">
October 25, 2010 6:20 PM
</a>
<span class="item-control blog-admin pid-1275709068">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=7164623565863772295" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author blog-author" id="c9188290840224731722">
<a name="c9188290840224731722"></a>
<div class="avatar-image-container vcard"><span dir="ltr"><a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow" onclick="" class="avatar-hovercard" id="av-1-02016807982653343777"><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" alt="" class="delayLoad" style="" longdesc="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" title="Blaise Doughan" height="35" width="35">

<noscript><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" width="35" height="35" class="photo" alt=""></noscript></a></span></div>
<a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow">Blaise Doughan</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-9188290840224731722">
<p>
In this example I set a couple of JAXB annotations at the package level.  This can be done by using a class named <a href="http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.4.1.1" rel="nofollow">package-info</a>.<br><br><b>@XmlAccessorType</b><br>The @XmlAccessorType can also be set at the type level.  To eliminate its use all together simply annotate the public get (or set) method instead of the private field.<br><br><b>@XmlSchema</b><br>JAXB has support for <a href="http://bdoughan.blogspot.com/2010/08/jaxb-namespaces.html" rel="nofollow">specifying namespace information</a> at the package, type, and property/field levels.<br><br>Alternatively MOXy offers the ability to represent the JAXB metadata as an XML file:<br><br>- <a href="http://wiki.eclipse.org/EclipseLink/Examples/MOXy/EclipseLink-OXM.XML" rel="nofollow">http://wiki.eclipse.org/EclipseLink/Examples/MOXy/EclipseLink-OXM.XML</a>
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1288099572234#c9188290840224731722" title="comment permalink">
October 26, 2010 9:26 AM
</a>
<span class="item-control blog-admin pid-1640643438">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=9188290840224731722" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author " id="c3460792208483940741">
<a name="c3460792208483940741"></a>
<div class="avatar-image-container avatar-stock"><span dir="ltr"><img src="http://img1.blogblog.com/img/blank.gif" alt="" title="Anonymous" height="16" width="16">

</span></div>
Anonymous
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-3460792208483940741">
<p>
I've used Simple and one of the nice things about it is the ability to use polymorphisim via fields or property methods, for example.<br><br>@ElementList<br>private List list = new MyListType()<br><br>Can JAXB figure out a list assignment like this? If so does it require an annotation with a specific type to use?
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1288151058098#c3460792208483940741" title="comment permalink">
October 26, 2010 11:44 PM
</a>
<span class="item-control blog-admin pid-295194462">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=3460792208483940741" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author blog-author" id="c3288383960610575868">
<a name="c3288383960610575868"></a>
<div class="avatar-image-container vcard"><span dir="ltr"><a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow" onclick="" class="avatar-hovercard" id="av-3-02016807982653343777"><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" alt="" class="delayLoad" style="" longdesc="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" title="Blaise Doughan" height="35" width="35">

<noscript><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" width="35" height="35" class="photo" alt=""></noscript></a></span></div>
<a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow">Blaise Doughan</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-3288383960610575868">
<p>
Anonymous,<br><br><b>Simple</b><br><br>If we change the Simple @ElementList annotation we used on the "phoneNumbers" property to be the following  @ElementList(entry="phone-number"), then a grouping element will be created that looks like the following:<br><br>&lt;phoneNumbers class="java.util.ArrayList"&gt;<br><br>I presume this means that the when unmarshalling the XML the java.uti.List property should be populated with an instance of java.util.ArrayList.<br><br>For this type of mechanism to work, the following needs to be true:<br>- Both the object used to produce XML, and the object used to consume the XML both need to use ArrayList for that value.<br>- If there is an XML schema associated with this XML it needs to account for the class attribute.<br><br><b>JAXB</b><br><br>If you initialize a property with a particular implementation of list then JAXB will use that initialized list.  If one was not pre-initialized an implementation will be chosen for you (both Metro and MOXy will use ArrayList).  In EclipseLink 2.2, MOXy will offer the ability to specify List implementation in its XML version of the metadata.<br><br>-Blaise
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1288188994693#c3288383960610575868" title="comment permalink">
October 27, 2010 10:16 AM
</a>
<span class="item-control blog-admin pid-1640643438">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=3288383960610575868" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author " id="c6393072972411702232">
<a name="c6393072972411702232"></a>
<div class="avatar-image-container avatar-stock"><span dir="ltr"><img src="http://img1.blogblog.com/img/blank.gif" alt="" title="Anonymous" height="16" width="16">

</span></div>
Anonymous
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-6393072972411702232">
<p>
Nice tutorial<br><br>I have one question.<br>Is there a way to marshall/unmarshall a collection of objects without having to create a new java wrapper class.<br><br>Regards
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1288190566403#c6393072972411702232" title="comment permalink">
October 27, 2010 10:42 AM
</a>
<span class="item-control blog-admin pid-2024409471">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=6393072972411702232" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author blog-author" id="c7412456550682096823">
<a name="c7412456550682096823"></a>
<div class="avatar-image-container vcard"><span dir="ltr"><a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow" onclick="" class="avatar-hovercard" id="av-5-02016807982653343777"><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" alt="" class="delayLoad" style="" longdesc="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" title="Blaise Doughan" height="35" width="35">

<noscript><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" width="35" height="35" class="photo" alt=""></noscript></a></span></div>
<a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow">Blaise Doughan</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-7412456550682096823">
<p>
Currently you will need to use a wrapper class to handle this use case.  I have entered an enhancement request against MOXy for this issue (see below).  Feel free to add any additional details to the request that you feel are useful for us to consider:<br><br>- <a href="https://bugs.eclipse.org/328862" rel="nofollow">https://bugs.eclipse.org/328862</a>
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1288200152773#c7412456550682096823" title="comment permalink">
October 27, 2010 1:22 PM
</a>
<span class="item-control blog-admin pid-1640643438">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=7412456550682096823" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author " id="c8688852210660952255">
<a name="c8688852210660952255"></a>
<div class="avatar-image-container avatar-stock"><span dir="ltr"><a href="http://www.blogger.com/profile/15076878807323376732" rel="nofollow" onclick="" class="avatar-hovercard" id="av-6-15076878807323376732"><img src="http://img2.blogblog.com/img/b16-rounded.gif" alt="" title="christopher" height="16" width="16">

</a></span></div>
<a href="http://www.blogger.com/profile/15076878807323376732" rel="nofollow">christopher</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-8688852210660952255">
<p>
I am new to JAXB and simple but found this useful. <br><br><br>I like the fact that for validation, JAXB is led by XSD. My understanding of simple is that you really have to re-write your XSD constraints into your annotations to get the validation of the XML. That's a big weakness, if my understanding is right. <br><br>However, I liked the fact that in simple, I was not forced to having a no-arg constructor. I want immutable classes. I liked having a constructor which looked like this<br><br><br>public XmlMessage(@Attribute(name="v", required=true) int version,<br>  @Element(name="sc") Script script,<br>  @Element(name="pa") Patient patient,<br>  @Element(name="pb") Prescriber prescriber,<br> @ElementList(name="drugs",inline=true) List drugs ) {<br>  super();<br>  this.version = version;<br>  this.script = script;<br>  this.patient = patient;<br>  this.prescriber = prescriber;<br>  this.drugs = drugs;<br> }<br><br>My work with JAXB so far seems to not allow this type of thing.
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1288283853646#c8688852210660952255" title="comment permalink">
October 28, 2010 12:37 PM
</a>
<span class="item-control blog-admin pid-395632613">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=8688852210660952255" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author blog-author" id="c8038086052775113436">
<a name="c8038086052775113436"></a>
<div class="avatar-image-container vcard"><span dir="ltr"><a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow" onclick="" class="avatar-hovercard" id="av-7-02016807982653343777"><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" alt="" class="delayLoad" style="" longdesc="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" title="Blaise Doughan" height="35" width="35">

<noscript><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" width="35" height="35" class="photo" alt=""></noscript></a></span></div>
<a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow">Blaise Doughan</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-8038086052775113436">
<p>
Christopher,<br><br>With JAXB you can optionally register an instance of <a href="http://download.oracle.com/javase/6/docs/api/javax/xml/validation/Schema.html" rel="nofollow">javax.xml.validation.Schema</a> with both the marshaller and unmarshaller to validate against an XSD.<br><br>JAXB requires a no-arg constructor.  You can workaround this issue through the use of XmlAdapter.  I will post an example of how to do this on my blog soon.<br><br>I have entered the following enhancement request to cover support for multi-arg constructors.  Feel free to add any information you feel is relevant.<br><br>- <a href="https://bugs.eclipse.org/328951" rel="nofollow">https://bugs.eclipse.org/328951</a><br><br>-Blaise
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1288288153094#c8038086052775113436" title="comment permalink">
October 28, 2010 1:49 PM
</a>
<span class="item-control blog-admin pid-1640643438">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=8038086052775113436" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author " id="c5683531497830244515">
<a name="c5683531497830244515"></a>
<div class="avatar-image-container avatar-stock"><span dir="ltr"><a href="http://www.blogger.com/profile/15954885610441191744" rel="nofollow" onclick="" class="avatar-hovercard" id="av-8-15954885610441191744"><img src="http://img2.blogblog.com/img/b16-rounded.gif" alt="" title="B0DYLANG" height="16" width="16">

</a></span></div>
<a href="http://www.blogger.com/profile/15954885610441191744" rel="nofollow">B0DYLANG</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-5683531497830244515">
<p>
Hi All,<br>regarding the case of using extra attribute like the "class" from the simpleXml it could be solved by using a  Visitor implementation that can inspect the serilization process and remove any un-wantred field.<br>But I have a small question, can we in JAXB, SimpleXML de-serilize an XML even if the case differs (case in-sensitive)?
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1290802370992#c5683531497830244515" title="comment permalink">
November 26, 2010 3:12 PM
</a>
<span class="item-control blog-admin pid-528975804">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=5683531497830244515" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author blog-author" id="c6503524094734258891">
<a name="c6503524094734258891"></a>
<div class="avatar-image-container vcard"><span dir="ltr"><a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow" onclick="" class="avatar-hovercard" id="av-9-02016807982653343777"><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" alt="" class="delayLoad" style="" longdesc="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" title="Blaise Doughan" height="35" width="35">

<noscript><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" width="35" height="35" class="photo" alt=""></noscript></a></span></div>
<a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow">Blaise Doughan</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-6503524094734258891">
<p>
Hi BODYLANG,<br><br>Agreed a visitor could be used to remove unwanted field, but since Simple XML markets itself as being simple, extra steps count against it there.<br><br>However you could use extra steps to support case insensitive mapping in JAXB (and probably Simple XML).  You could map all your properties to lower case node names, and then wrap an XMLStreamReader to call toLowerCase() on all attribute/element names it returned.<br><br>I have added an enhance request for EclipseLink JAXB (MOXy) for this issue, feel free to provide additional information:<br><br>- <a href="https://bugs.eclipse.org/331241" rel="nofollow">https://bugs.eclipse.org/331241</a><br><br>-Blaise
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1290804211305#c6503524094734258891" title="comment permalink">
November 26, 2010 3:43 PM
</a>
<span class="item-control blog-admin pid-1640643438">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=6503524094734258891" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author blog-author" id="c8419103644256793577">
<a name="c8419103644256793577"></a>
<div class="avatar-image-container vcard"><span dir="ltr"><a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow" onclick="" class="avatar-hovercard" id="av-10-02016807982653343777"><img src="http://img1.blogblog.com/img/blank.gif" alt="" class="delayLoad" style="" longdesc="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" title="Blaise Doughan" height="35" width="35">

<noscript><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" width="35" height="35" class="photo" alt=""></noscript></a></span></div>
<a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow">Blaise Doughan</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-8419103644256793577">
<p>
Hi BODYLANG,<br><br>I have posted an example on how case insensitive unmarshalling could be done using JAXB today:<br><br>- <a href="http://bdoughan.blogspot.com/2010/12/case-insensitive-unmarshalling.html" rel="nofollow">Case Insensitive Unmarshalling with JAXB</a><br><br>-Blaise
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1291757978257#c8419103644256793577" title="comment permalink">
December 7, 2010 4:39 PM
</a>
<span class="item-control blog-admin pid-1640643438">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=8419103644256793577" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author " id="c3526556545928458371">
<a name="c3526556545928458371"></a>
<div class="avatar-image-container avatar-stock"><span dir="ltr"><img src="http://img1.blogblog.com/img/blank.gif" alt="" title="Anonymous" height="16" width="16">

</span></div>
Anonymous
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-3526556545928458371">
<p>
Hi,<br><br>This looks useful, however I think it works a little better in Simple. You can simply style the attributes and elements with a Style object, this avoids, which means you get transparent serialization and deserialization regardless of case. <br><br>It would be good to support a feature that can intercept the marshalling and unmarshalling and adapt the names transparently.<br><br>Tom
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1293003375074#c3526556545928458371" title="comment permalink">
December 22, 2010 2:36 AM
</a>
<span class="item-control blog-admin pid-2093227689">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=3526556545928458371" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author blog-author" id="c4422448518031590650">
<a name="c4422448518031590650"></a>
<div class="avatar-image-container vcard"><span dir="ltr"><a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow" onclick="" class="avatar-hovercard" id="av-12-02016807982653343777"><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" alt="" class="delayLoad" style="" longdesc="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" title="Blaise Doughan" height="35" width="35">

<noscript><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" width="35" height="35" class="photo" alt=""></noscript></a></span></div>
<a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow">Blaise Doughan</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-4422448518031590650">
<p>
Hi Tom,<br><br>Thanks for the suggestion.  I have entered the following enhancement request for <a href="http://www.eclipse.org/eclipselink/moxy.php" rel="nofollow">EclipseLink MOXy</a>:<br><br>- <a href="https://bugs.eclipse.org/333601" rel="nofollow">Enhancement: Customizable Name Mangling Algorithm</a><br><br>-Blaise
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1294260091999#c4422448518031590650" title="comment permalink">
January 5, 2011 3:41 PM
</a>
<span class="item-control blog-admin pid-1640643438">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=4422448518031590650" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author " id="c7783601068075583505">
<a name="c7783601068075583505"></a>
<div class="avatar-image-container avatar-stock"><span dir="ltr"><img src="http://img1.blogblog.com/img/blank.gif" alt="" title="Anonymous" height="16" width="16">

</span></div>
Anonymous
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-7783601068075583505">
<p>
My colleague says that the XML serialisation and deserialisation with Simple is inefficient, only writing/reading a few bytes at a time to/from disk. According to him, it looks like the serialisation writes one attribute at a time. The deserialisation is even worse, reading a single byte at a time from disk.<br><br>Is this claim true?<br><br>Bala
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1307698538523#c7783601068075583505" title="comment permalink">
June 10, 2011 5:35 AM
</a>
<span class="item-control blog-admin pid-762896129">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=7783601068075583505" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author blog-author" id="c4933265035039947414">
<a name="c4933265035039947414"></a>
<div class="avatar-image-container vcard"><span dir="ltr"><a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow" onclick="" class="avatar-hovercard" id="av-14-02016807982653343777"><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" alt="" class="delayLoad" style="" longdesc="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" title="Blaise Doughan" height="35" width="35">

<noscript><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" width="35" height="35" class="photo" alt=""></noscript></a></span></div>
<a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow">Blaise Doughan</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-4933265035039947414">
<p>
Hi Bala,<br><br>I can't speak to how Simple is implemented.  In <a href="http://www.eclipse.org/eclipselink/moxy.php" rel="nofollow">EclipseLink JAXB (MOXy)</a> we leverage a <a href="http://download.oracle.com/javase/6/docs/api/java/io/BufferedWriter.html" rel="nofollow">java.io.BufferedWriter</a> to solve this problem for writing.<br><br>-Blaise
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1308057309726#c4933265035039947414" title="comment permalink">
June 14, 2011 9:15 AM
</a>
<span class="item-control blog-admin pid-1640643438">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=4933265035039947414" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author " id="c9159166222194328062">
<a name="c9159166222194328062"></a>
<div class="avatar-image-container vcard"><span dir="ltr"><a href="http://www.blogger.com/profile/03921314791126072841" rel="nofollow" onclick="" class="avatar-hovercard" id="av-15-03921314791126072841"><img src="http://1.bp.blogspot.com/_796TxviAAhE/SXo-B-GlKyI/AAAAAAAAABk/kJVoKvhVdx4/S45/pix.jpg" alt="" class="delayLoad" style="" longdesc="http://1.bp.blogspot.com/_796TxviAAhE/SXo-B-GlKyI/AAAAAAAAABk/kJVoKvhVdx4/S45/pix.jpg" title="Paul Taylor" height="35" width="35">

<noscript><img src="http://1.bp.blogspot.com/_796TxviAAhE/SXo-B-GlKyI/AAAAAAAAABk/kJVoKvhVdx4/S45/pix.jpg" width="35" height="35" class="photo" alt=""></noscript></a></span></div>
<a href="http://www.blogger.com/profile/03921314791126072841" rel="nofollow">Paul Taylor</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-9159166222194328062">
<p>
Im happy with JAXB but now I need to write something on Android, JAXB isnt suitable for this but SimpleXml is. Do you of any tool that could convert JAXB clases to Simple ones ?
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1310067099653#c9159166222194328062" title="comment permalink">
July 7, 2011 3:31 PM
</a>
<span class="item-control blog-admin pid-1809120898">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=9159166222194328062" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
<dt class="comment-author blog-author" id="c3642693926939289873">
<a name="c3642693926939289873"></a>
<div class="avatar-image-container vcard"><span dir="ltr"><a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow" onclick="" class="avatar-hovercard" id="av-16-02016807982653343777"><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" alt="" class="delayLoad" style="" longdesc="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" title="Blaise Doughan" height="35" width="35">

<noscript><img src="http://2.bp.blogspot.com/_pNe6uY1wAw4/TDY9DUHoSKI/AAAAAAAAAAk/iI_BfGY-LiA/S45/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" width="35" height="35" class="photo" alt=""></noscript></a></span></div>
<a href="http://www.blogger.com/profile/02016807982653343777" rel="nofollow">Blaise Doughan</a>
said...
</dt>
<dd class="comment-body" id="Blog1_cmt-3642693926939289873">
<p>
Hi Paul,<br><br>I am not aware of any such tool.  As the <a href="http://www.eclipse.org/eclipselink/moxy.php" rel="nofollow">EclipseLink JAXB (MOXy)</a> lead, I have not investigated the existence of such a tool.  However, I'm more than happy to help people port form SimpleXML to JAXB.<br><br>-Blaise
</p>
</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html?showComment=1310149819216#c3642693926939289873" title="comment permalink">
July 8, 2011 2:30 PM
</a>
<span class="item-control blog-admin pid-1640643438">
<a class="comment-delete" href="http://www.blogger.com/delete-comment.g?blogID=1710464868724994296&amp;postID=3642693926939289873" title="Delete Comment">
<img src="//www.blogger.com/img/icon_delete13.gif">
</a>
</span>
</span>
</dd>
</dl>
</div>
<p class="comment-footer">
</p>
<!--<div class="comment-form">
<a name="comment-form"></a>
<h4 id="comment-post-message">Post a Comment</h4>
<p>
</p>
<a href="http://www.blogger.com/comment-iframe.g?blogID=1710464868724994296&amp;postID=1878841028455754447&amp;blogspotRpcToken=3354630" id="comment-editor-src"></a>
<iframe allowtransparency="true" class="blogger-iframe-colorize blogger-comment-from-post" id="comment-editor" name="comment-editor" src="http://www.blogger.com/comment-iframe.g?blogID=1710464868724994296&amp;postID=1878841028455754447&amp;blogspotRpcToken=3354630#%7B%22color%22%3A%22rgb%2851%2C%2051%2C%2051%29%22%2C%22backgroundColor%22%3A%22rgb%28255%2C%20255%2C%20255%29%22%2C%22unvisitedLinkColor%22%3A%22rgb%2851%2C%20102%2C%20153%29%22%2C%22fontFamily%22%3A%22sans-serif%22%7D"
        frameborder="0" height="410" width="100%"></iframe>
<script type="text/javascript" src="http://www.blogger.com/static/v1/jsbin/957670695-comment_from_post_iframe.js"></script>
<script type="text/javascript">
      BLOG_CMT_createIframe('http://www.blogger.com/rpc_relay.html', '11636103603009674097');
    </script>
</div>-->
<p></p>
<div id="backlinks-container">
<div id="Blog1_backlinks-container">
</div>
</div>
</div>
</div>
<div id="latency-1878841028455754447"></div><script type="text/javascript">if (window['tickAboveFold']) {window['tickAboveFold'](document.getElementById("latency-1878841028455754447")); } </script>

        </div></div>
      
<!-- google_ad_section_end -->
</div>
<div class="blog-pager" id="blog-pager">
<span id="blog-pager-newer-link">
<a class="blog-pager-newer-link" href="http://blog.bdoughan.com/2010/11/jaxb-and-inheritance-using-xsitype.html" id="Blog1_blog-pager-newer-link" title="Newer Post">Newer Post</a>
</span>
<span id="blog-pager-older-link">
<a class="blog-pager-older-link" href="http://blog.bdoughan.com/2010/10/jaxb-and-xsd-choice-xmlelements.html" id="Blog1_blog-pager-older-link" title="Older Post">Older Post</a>
</span>
<a class="home-link" href="http://blog.bdoughan.com/">Home</a>
</div>
<div class="clear"></div>
<div class="post-feeds">
<div class="feed-links">
Subscribe to:
<a class="feed-link" href="http://blog.bdoughan.com/feeds/1878841028455754447/comments/default" target="_blank" type="application/atom+xml">Post Comments (Atom)</a>
</div>
</div>
<script type="text/javascript">window.___gcfg = {'lang': 'en'};window.___gapisync = false;(function() {var po = document.createElement('script');po.type = 'text/javascript';po.async = true;po.src = 'https://apis.google.com/js/plusone.js';var s = document.body.getElementsByTagName('script')[0];s.parentNode.insertBefore(po, s);})();</script>
</div></div>
</div>
</div>
<div class="column-left-outer">
<div class="column-left-inner">
<aside>
</aside>
</div>
</div>
<div class="column-right-outer">
<div class="column-right-inner">
<aside>
<div class="sidebar section" id="sidebar-right-1"><div class="widget Stats" id="Stats1">
<h2>Total Pageviews</h2>
<div class="widget-content">
<div id="Stats1_content" style="">
<span class="counter-wrapper graph-counter-wrapper" id="Stats1_totalCount"><span class="digit stage-0"><strong>1</strong><span class="blind-plate"></span></span><span class="digit stage-0"><strong>5</strong><span class="blind-plate"></span></span><span class="digit stage-0"><strong>4</strong><span class="blind-plate"></span></span><span class="digit stage-0"><strong>9</strong><span class="blind-plate"></span></span><span class="digit stage-0"><strong>6</strong><span class="blind-plate"></span></span><span class="digit stage-0"><strong>9</strong><span class="blind-plate"></span></span></span>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=Stats&amp;widgetId=Stats1&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("Stats1"));' target="configStats1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div>
</div>
</div><div class="widget Profile" id="Profile1">
<h2>About Me</h2>
<div class="widget-content">
<a href="http://www.blogger.com/profile/02016807982653343777"><img alt="My Photo" class="profile-img" src="http://4.bp.blogspot.com/_pNe6uY1wAw4/TDY9Cu_1J-I/AAAAAAAAAAM/TJ1EXJYjj5M/s1600-R/dc3ee2f4f742fbbafeeb0b7414cb6fd2.png" height="80" width="80"></a>
<dl class="profile-datablock">
<dt class="profile-data">
<a class="profile-name-link" href="http://www.blogger.com/profile/02016807982653343777" rel="author">
Blaise Doughan
</a>
</dt>
<dd class="profile-textblock">Team lead for the TopLink / EclipseLink JAXB &amp; SDO implementations, and the Oracle representative on those specifications.</dd>
</dl>
<a class="profile-link" href="http://www.blogger.com/profile/02016807982653343777" rel="author">View my complete profile</a>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=Profile&amp;widgetId=Profile1&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("Profile1"));' target="configProfile1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div>
</div><div class="widget CustomSearch" id="CustomSearch1">
<h2 class="title">Search This Blog</h2>
<div class="widget-content">
<div id="CustomSearch1_form">
<span class="cse-status">Loading...</span>
</div>
</div>
<style type="text/css">
      #uds-searchControl .gs-result .gs-title,
      #uds-searchControl .gs-result .gs-title *,
      #uds-searchControl .gsc-results .gsc-trailing-more-results,
      #uds-searchControl .gsc-results .gsc-trailing-more-results * {
        color:#336699;
      }

      #uds-searchControl .gs-result .gs-title a:visited,
      #uds-searchControl .gs-result .gs-title a:visited * {
        color:#6699cc;
      }

      #uds-searchControl .gs-relativePublishedDate,
      #uds-searchControl .gs-publishedDate {
        color: #6f6f6f;
      }

      #uds-searchControl .gs-result a.gs-visibleUrl,
      #uds-searchControl .gs-result .gs-visibleUrl {
        color: #336699;
      }

      #uds-searchControl .gsc-results {
        border-color: #dddddd;
        background-color: #ffffff;
      }

      #uds-searchControl .gsc-tabhActive {
        border-color: #dddddd;
        border-top-color: #dddddd;
        background-color: #ffffff;
        color: #333333;
      }

      #uds-searchControl .gsc-tabhInactive {
        border-color: #dddddd;
        background-color: transparent;
        color: #336699;
      }

      #uds-searchClearResults {
        border-color: #dddddd;
      }

      #uds-searchClearResults:hover {
        border-color: #dddddd;
      }

      #uds-searchControl .gsc-cursor-page {
        color: #336699;
      }

      #uds-searchControl .gsc-cursor-current-page {
        color: #333333;
      }
    </style>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=CustomSearch&amp;widgetId=CustomSearch1&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("CustomSearch1"));' target="configCustomSearch1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div><div class="widget BlogArchive" id="BlogArchive1">
<h2>Blog Archive</h2>
<div class="widget-content">
<div id="ArchiveList">
<div id="BlogArchive1_ArchiveList">
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/search?updated-min=2011-01-01T00%3A00%3A00-05%3A00&amp;updated-max=2012-01-01T00%3A00%3A00-05%3A00&amp;max-results=35">2011</a>
<span class="post-count" dir="ltr">(35)</span>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2011_08_01_archive.html">August</a>
<span class="post-count" dir="ltr">(6)</span>
<ul class="posts">
<li><a href="http://blog.bdoughan.com/2011/08/xml-schema-to-java-generating.html">XML Schema to Java - Generating XmlAdapters</a></li>
<li><a href="http://blog.bdoughan.com/2011/08/jaxb-and-enums.html">JAXB and Enums</a></li>
<li><a href="http://blog.bdoughan.com/2011/08/jaxb-and-java-io-files-streams-readers.html">JAXB and Java IO (Files, Streams, Readers, and Wri...</a></li>
<li><a href="http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html">Binding to JSON &amp; XML - Geocode Example</a></li>
<li><a href="http://blog.bdoughan.com/2011/08/using-unmarshallerlistener-to-capture.html">Using an Unmarshaller.Listener to Capture the Loca...</a></li>
<li><a href="http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html">JSON Binding with EclipseLink MOXy - Twitter Examp...</a></li>
</ul>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2011_07_01_archive.html">July</a>
<span class="post-count" dir="ltr">(1)</span>
<ul class="posts">
<li><a href="http://blog.bdoughan.com/2011/07/jaxb-xjc-and-nested-classes.html">JAXB (XJC) and Nested Classes</a></li>
</ul>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2011_06_01_archive.html">June</a>
<span class="post-count" dir="ltr">(10)</span>
<ul class="posts">
<li><a href="http://blog.bdoughan.com/2011/06/jaxb-and-complex-types-with-simple.html">JAXB and Complex Types with Simple Content</a></li>
<li><a href="http://blog.bdoughan.com/2011/06/jaxb-and-factory-methods.html">JAXB and Factory Methods</a></li>
<li><a href="http://blog.bdoughan.com/2011/06/using-jaxbs-xmlaccessortype-to.html">Using JAXB's @XmlAccessorType to Configure Field o...</a></li>
<li><a href="http://blog.bdoughan.com/2011/06/eclipselink-23-release-available-for.html">EclipseLink 2.3 Release Available for Download</a></li>
<li><a href="http://blog.bdoughan.com/2011/06/moxy-extensible-models-multiple.html">MOXy Extensible Models - Multiple Versions</a></li>
<li><a href="http://blog.bdoughan.com/2011/06/moxy-extensible-models-refresh-example.html">MOXy Extensible Models - Refresh Example</a></li>
<li><a href="http://blog.bdoughan.com/2011/06/using-eclipselink-moxy-with-metadata.html">Using EclipseLink MOXy with a Metadata Repository</a></li>
<li><a href="http://blog.bdoughan.com/2011/06/moxy-extensible-models-multi-tenant.html">MOXy Extensible Models - Multi-Tenant Example</a></li>
<li><a href="http://blog.bdoughan.com/2011/06/extensible-models-with-eclipselink-jaxb.html">Extensible Models with EclipseLink JAXB (MOXy)</a></li>
<li><a href="http://blog.bdoughan.com/2011/06/ignoring-inheritance-with-xmltransient.html">Ignoring Inheritance with @XmlTransient</a></li>
</ul>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2011_05_01_archive.html">May</a>
<span class="post-count" dir="ltr">(6)</span>
<ul class="posts">
<li><a href="http://blog.bdoughan.com/2011/05/jaxb-and-joda-time-dates-and-times.html">JAXB and Joda-Time: Dates and Times</a></li>
<li><a href="http://blog.bdoughan.com/2011/05/overriding-jaxbs-name-mangling.html">Overriding JAXB's "Name Mangling" Algorithm with E...</a></li>
<li><a href="http://blog.bdoughan.com/2011/05/jaxb-and-dtd.html">JAXB and DTD - Apache log4j Example</a></li>
<li><a href="http://blog.bdoughan.com/2011/05/jaxb-and-interface-fronted-models.html">JAXB and Interface Fronted Models</a></li>
<li><a href="http://blog.bdoughan.com/2011/05/schema-to-java-xmlmimetype.html">Schema to Java:  @XmlMimeType &amp; @XmlInlineBinaryDa...</a></li>
<li><a href="http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html">Specifying EclipseLink MOXy as Your JAXB Provider</a></li>
</ul>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2011_04_01_archive.html">April</a>
<span class="post-count" dir="ltr">(5)</span>
<ul class="posts">
<li><a href="http://blog.bdoughan.com/2011/04/xmlanyelement-and-non-dom-properties.html">@XmlAnyElement and non-DOM Properties</a></li>
<li><a href="http://blog.bdoughan.com/2011/04/jaxb-and-json-via-jettison-namespace.html">JAXB and JSON via Jettison - Namespace Example</a></li>
<li><a href="http://blog.bdoughan.com/2011/04/xml-schema-to-java-xsd-choice.html">XML Schema to Java - XSD Choice</a></li>
<li><a href="http://blog.bdoughan.com/2011/04/jaxb-and-json-via-jettison.html">JAXB and JSON via Jettison</a></li>
<li><a href="http://blog.bdoughan.com/2011/04/moxys-xml-metadata-in-jax-rs-service.html">MOXy's XML Metadata in a JAX-RS Service</a></li>
</ul>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2011_03_01_archive.html">March</a>
<span class="post-count" dir="ltr">(5)</span>
<ul class="posts">
<li><a href="http://blog.bdoughan.com/2011/03/jaxb-web-services-and-binary-data.html">JAXB, Web Services, and Binary Data</a></li>
<li><a href="http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html">Map to Element based on an Attribute Value with Ec...</a></li>
<li><a href="http://blog.bdoughan.com/2011/03/preventing-entity-expansion-attacks-in.html">Preventing Entity Expansion Attacks in JAXB</a></li>
<li><a href="http://blog.bdoughan.com/2011/03/handling-duplicate-xmlrootelement.html">Handling Duplicate @XmlRootElement Declarations</a></li>
<li><a href="http://blog.bdoughan.com/2011/03/using-jaxb-to-implement-copy-operation.html">Using JAXB to Implement a Copy Operation</a></li>
</ul>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2011_01_01_archive.html">January</a>
<span class="post-count" dir="ltr">(2)</span>
<ul class="posts">
<li><a href="http://blog.bdoughan.com/2011/01/jaxb-and-choosing-list-implementation.html">JAXB and Choosing the  List Implementation</a></li>
<li><a href="http://blog.bdoughan.com/2011/01/jaxb-and-datetime-properties.html">JAXB and Date/Time Properties</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate expanded">
<a class="toggle" href="javascript:void(0)">
<span class="zippy toggle-open">▼&nbsp;</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/search?updated-min=2010-01-01T00%3A00%3A00-05%3A00&amp;updated-max=2011-01-01T00%3A00%3A00-05%3A00&amp;max-results=34">2010</a>
<span class="post-count" dir="ltr">(34)</span>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2010_12_01_archive.html">December</a>
<span class="post-count" dir="ltr">(5)</span>
<ul class="posts">
<li><a href="http://blog.bdoughan.com/2010/12/represent-string-values-as-element.html">Represent String Values as Element Names with JAXB...</a></li>
<li><a href="http://blog.bdoughan.com/2010/12/jaxb-and-marshalunmarshal-schema.html">JAXB and Marshal/Unmarshal Schema Validation</a></li>
<li><a href="http://blog.bdoughan.com/2010/12/extending-jaxb-representing-annotations.html">Extending JAXB - Representing Metadata as XML</a></li>
<li><a href="http://blog.bdoughan.com/2010/12/case-insensitive-unmarshalling.html">Case Insensitive Unmarshalling with JAXB</a></li>
<li><a href="http://blog.bdoughan.com/2010/12/jaxb-and-immutable-objects.html">JAXB and Immutable Objects</a></li>
</ul>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2010_11_01_archive.html">November</a>
<span class="post-count" dir="ltr">(4)</span>
<ul class="posts">
<li><a href="http://blog.bdoughan.com/2010/11/validate-jaxb-object-model-with-xml.html">Validate a JAXB Object Model With an XML Schema</a></li>
<li><a href="http://blog.bdoughan.com/2010/11/jaxb-and-inheritance-moxy-extension.html">JAXB and Inheritance - MOXy Extension @XmlDescrimi...</a></li>
<li><a href="http://blog.bdoughan.com/2010/11/jaxb-and-inheritance-using-substitution.html">JAXB and Inheritance - Using Substitution Groups</a></li>
<li><a href="http://blog.bdoughan.com/2010/11/jaxb-and-inheritance-using-xsitype.html">JAXB and Inheritance - Using the xsi:type Attribut...</a></li>
</ul>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate expanded">
<a class="toggle" href="javascript:void(0)">
<span class="zippy toggle-open">▼&nbsp;</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2010_10_01_archive.html">October</a>
<span class="post-count" dir="ltr">(4)</span>
<ul class="posts">
<li><a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-simple.html">How Does JAXB Compare to Simple?</a></li>
<li><a href="http://blog.bdoughan.com/2010/10/jaxb-and-xsd-choice-xmlelements.html">JAXB and XSD Choice:  @XmlElements</a></li>
<li><a href="http://blog.bdoughan.com/2010/10/jaxb-and-shared-references-xmlid-and.html">JAXB and Shared References:  @XmlID and @XmlIDREF</a></li>
<li><a href="http://blog.bdoughan.com/2010/10/how-does-jaxb-compare-to-xstream.html">How Does JAXB Compare to XStream?</a></li>
</ul>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2010_09_01_archive.html">September</a>
<span class="post-count" dir="ltr">(5)</span>
<ul class="posts">
<li><a href="http://blog.bdoughan.com/2010/09/jaxb-collection-properties.html">JAXB &amp; Collection Properties</a></li>
<li><a href="http://blog.bdoughan.com/2010/09/jaxb-xml-infoset-preservation.html">JAXB &amp; XML Infoset Preservation</a></li>
</ul>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2010_08_01_archive.html">August</a>
<span class="post-count" dir="ltr">(10)</span>
</li>
</ul>
<ul class="hierarchy">
<li class="archivedate collapsed">
<a class="toggle" href="javascript:void(0)">
<span class="zippy">

          ►&nbsp;
        
</span>
</a>
<a class="post-count-link" href="http://blog.bdoughan.com/2010_07_01_archive.html">July</a>
<span class="post-count" dir="ltr">(6)</span>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=BlogArchive&amp;widgetId=BlogArchive1&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("BlogArchive1"));' target="configBlogArchive1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div>
</div><div class="widget Label" id="Label1">
<h2>Labels</h2>
<div class="widget-content list-label-widget-content">
<ul>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/%22Bindings%20File%22">"Bindings File"</a>
<span dir="ltr">(6)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/%22Case%20Insensitivity%22">"Case Insensitivity"</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/%22Collection%20Property%22">"Collection Property"</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/%22EclipseLink%202.3%22">"EclipseLink 2.3"</a>
<span dir="ltr">(8)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/%22EclipseLink%202.4%22">"EclipseLink 2.4"</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/%22Entity%20Expansion%20Attack%22">"Entity Expansion Attack"</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/%22Immutable%20Object%22">"Immutable Object"</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/%22Mapping%20File%22">"Mapping File"</a>
<span dir="ltr">(6)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/%22XML%20Infoset%22">"XML Infoset"</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/%22XML%20Schema%22">"XML Schema"</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Atom">Atom</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Attachment">Attachment</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Binder">Binder</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/CDATA">CDATA</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Choice">Choice</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Comparison">Comparison</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Database">Database</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Date%2FTime">Date/Time</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/DTD">DTD</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/EclipseLink">EclipseLink</a>
<span dir="ltr">(23)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/EJB">EJB</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Enum">Enum</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Extension">Extension</a>
<span dir="ltr">(20)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Geocode">Geocode</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Inheritance">Inheritance</a>
<span dir="ltr">(4)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Interface">Interface</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/JavaOne">JavaOne</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/JAX-RS">JAX-RS</a>
<span dir="ltr">(6)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/JAX-WS">JAX-WS</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/JAXB">JAXB</a>
<span dir="ltr">(58)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/jaxb.properties">jaxb.properties</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/JAXBElement">JAXBElement</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/JAXBSource">JAXBSource</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Jettison">Jettison</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/JPA">JPA</a>
<span dir="ltr">(3)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/JSON">JSON</a>
<span dir="ltr">(4)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Marshaller">Marshaller</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/MetadataSource">MetadataSource</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/MOXy">MOXy</a>
<span dir="ltr">(26)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Multi-Tenant">Multi-Tenant</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Namespaces">Namespaces</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Predicate">Predicate</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Release">Release</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/REST">REST</a>
<span dir="ltr">(6)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/SDO">SDO</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Simple">Simple</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Specification">Specification</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/StAX">StAX</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/TopLink">TopLink</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Twitter">Twitter</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Unmarshaller">Unmarshaller</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Unmarshaller.Listener">Unmarshaller.Listener</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/UnmarshallerHandler">UnmarshallerHandler</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/Validation">Validation</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XJC">XJC</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlAccessorType">XmlAccessorType</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlAccessType">XmlAccessType</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlAdapter">XmlAdapter</a>
<span dir="ltr">(6)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlAnyElement">XmlAnyElement</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlElement">XmlElement</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlElementRef">XmlElementRef</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlElements">XmlElements</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlElementWrapper">XmlElementWrapper</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlEnum">XmlEnum</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlEnumValue">XmlEnumValue</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlID">XmlID</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlIDREF">XmlIDREF</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlInlineBinaryData">XmlInlineBinaryData</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlInverseReference">XmlInverseReference</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlList">XmlList</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlMimeType">XmlMimeType</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlPath">XmlPath</a>
<span dir="ltr">(4)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlRootElement">XmlRootElement</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlSchemaType">XmlSchemaType</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlTransformation">XmlTransformation</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlTransient">XmlTransient</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlType">XmlType</a>
<span dir="ltr">(1)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlValue">XmlValue</a>
<span dir="ltr">(2)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XmlVirtualAccessMethods">XmlVirtualAccessMethods</a>
<span dir="ltr">(4)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XPath">XPath</a>
<span dir="ltr">(3)</span>
</li>
<li>
<a dir="ltr" href="http://blog.bdoughan.com/search/label/XStream">XStream</a>
<span dir="ltr">(1)</span>
</li>
</ul>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=Label&amp;widgetId=Label1&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("Label1"));' target="configLabel1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div>
</div><div class="widget LinkList" id="LinkList1">
<h2>Related Links</h2>
<div class="widget-content">
<ul>
<li><a href="http://www.eclipse.org/eclipselink/moxy.php">EclipseLink MOXy</a></li>
<li><a href="http://jcp.org/en/jsr/detail?id=222">JAXB 2.2 (JSR-222)</a></li>
<li><a href="http://jcp.org/en/jsr/detail?id=235">SDO 2.1.1 (JSR-235)</a></li>
</ul>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=LinkList&amp;widgetId=LinkList1&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("LinkList1"));' target="configLinkList1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div>
</div><div class="widget Image" id="Image1">
<div class="widget-content">
<a href="http://www.eclipse.org/eclipselink">
<img alt="" id="Image1_img" src="http://www.eclipse.org/eclipselink/images/logo.jpg" height="45" width="150">
</a>
<br>
</div>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=Image&amp;widgetId=Image1&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("Image1"));' target="configImage1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div><div class="widget Followers" id="Followers1">
<h2 class="title">Followers</h2>
<div class="widget-content">
<div id="Followers1-wrapper">
<div style="margin-right:2px;">
<script type="text/javascript">
        if (!window.google || !google.friendconnect) {
          document.write('<script type="text/javascript"' +
              'src="http://www.google.com/friendconnect/script/friendconnect.js">' +
              '</scr' + 'ipt>');
        }
      </script><script type="text/javascript" src="http://www.google.com/friendconnect/script/friendconnect.js"></script>
<script type="text/javascript">
      if (!window.registeredBloggerCallbacks) {
        window.registeredBloggerCallbacks = true;

        

        
        gadgets.rpc.register('requestReload', function() {
          document.location.reload();
        });

        
        gadgets.rpc.register('requestSignOut', function(siteId) {
          
          google.friendconnect.container.openSocialSiteId = siteId;
          google.friendconnect.requestSignOut();
        });
      }
    </script>
<script type="text/javascript">
    
    function registerGetBlogUrls() {
      gadgets.rpc.register('getBlogUrls', function() {
        var holder = {};
        
          
            
            
              holder.currentPost = "http://www.blogger.com/feeds/1710464868724994296/posts/default/1878841028455754447";
            
            
            
              holder.currentComments = "http://www.blogger.com/feeds/1710464868724994296/1878841028455754447/comments/default";
            
            holder.currentPostUrl = "";
            holder.currentPostId = 1878841028455754447
          
          
          
            holder.postFeed = "http://www.blogger.com/feeds/1710464868724994296/posts/default";
          
          
          
            holder.commentFeed = "http://www.blogger.com/feeds/1710464868724994296/comments/default";
          
          holder.currentBlogUrl = "http://blog.bdoughan.com/";
          holder.currentBlogId = "1710464868724994296";
        
        return holder;
      });
    }
  </script>
<script type="text/javascript">
  if (!window.registeredCommonBloggerCallbacks) {
    window.registeredCommonBloggerCallbacks = true;

    gadgets.rpc.register('resize_iframe', function(height) {
      var el = document.getElementById(this['f']);
      if (el) {
        el.style.height = height + 'px';
      }
    });

    
    gadgets.rpc.register('set_pref', function() {});

    registerGetBlogUrls();
  }
  </script>
<div id="div-437s15z1kefq" style="width: 100%; "></div>
<script type="text/javascript">
    var skin = {};
    skin['FACE_SIZE'] = '32';
    skin['HEIGHT'] = "260";
    skin['TITLE'] = "Followers";
    skin['BORDER_COLOR'] = "transparent";
    skin['ENDCAP_BG_COLOR'] = "transparent";
    skin['ENDCAP_TEXT_COLOR'] = "#333333";
    skin['ENDCAP_LINK_COLOR'] = "#336699";
    skin['ALTERNATE_BG_COLOR'] = "transparent";
    
    skin['CONTENT_BG_COLOR'] = "transparent";
    skin['CONTENT_LINK_COLOR'] = "#336699";
    skin['CONTENT_TEXT_COLOR'] = "#333333";
    skin['CONTENT_SECONDARY_LINK_COLOR'] = "#336699";
    skin['CONTENT_SECONDARY_TEXT_COLOR'] = "#000000";
    skin['CONTENT_HEADLINE_COLOR'] = "#888888";
    skin['FONT_FACE'] = "normal normal 15px Arial, Tahoma, Helvetica, FreeSans, sans-serif";
    google.friendconnect.container.setParentUrl("/");
    google.friendconnect.container["renderMembersGadget"](
    {id: "div-437s15z1kefq",
     height: 260,
     
     
     
     site: "11636103603009674097",
      
     locale: 'en' },
     skin);
  </script>
</div>
</div>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=Followers&amp;widgetId=Followers1&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("Followers1"));' target="configFollowers1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div>
</div><div class="widget HTML" id="HTML1">
<h2 class="title">Twitter Updates</h2>
<div class="widget-content">
<div id="twitter_div">
<h2 class="sidebar-title" style="display:none;">Twitter Updates</h2>
<ul id="twitter_update_list"></ul>
<a href="http://twitter.com/bdoughan" id="twitter-link" style="display:block;text-align:right;">follow me on Twitter</a>
</div>
<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/bdoughan.json?callback=twitterCallback2&amp;count=5"></script>
</div>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=HTML&amp;widgetId=HTML1&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("HTML1"));' target="configHTML1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div><div class="widget HTML" id="HTML2">
<h2 class="title">Stack Overflow Profile</h2>
<div class="widget-content">
<a href="http://stackoverflow.com/users/383861/blaise-doughan">
<img src="http://stackoverflow.com/users/flair/383861.png" alt="Stack Overflow profile for Blaise Doughan" title="Stack Overflow profile for Blaise Doughan" height="58" width="208">
</a>
</div>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=HTML&amp;widgetId=HTML2&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("HTML2"));' target="configHTML2" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div><div class="widget HTML" id="HTML4">
<h2 class="title">Ohloh Profile</h2>
<div class="widget-content">
<a href="https://www.ohloh.net/accounts/126661?ref=detailed">
  <img alt="ohloh profile for blaise doughan" src="https://www.ohloh.net/accounts/126661/widgets/account_detailed.gif" height="35" width="191">
</a>
</div>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=HTML&amp;widgetId=HTML4&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("HTML4"));' target="configHTML4" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div><div class="widget HTML" id="HTML3">
<h2 class="title">Linked In Profile</h2>
<div class="widget-content">
<a href="http://ca.linkedin.com/in/bdoughan">
          <img src="http://www.linkedin.com/img/webpromo/btn_myprofile_160x33.png" alt="View Blaise Doughan's profile on LinkedIn" border="0" height="33" width="160">
    </a>
</div>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=HTML&amp;widgetId=HTML3&amp;action=editWidget&amp;sectionId=sidebar-right-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("HTML3"));' target="configHTML3" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div></div>
<table class="section-columns columns-2" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="first columns-cell">
<div class="sidebar section" id="sidebar-right-2-1"></div>
</td>
<td class="columns-cell">
<div class="sidebar section" id="sidebar-right-2-2"></div>
</td>
</tr>
</tbody>
</table>
<div class="sidebar section" id="sidebar-right-3"></div>
</aside>
</div>
</div>
</div>
<div style="clear: both"></div>
<!-- columns -->
</div>
<!-- main -->
</div>
</div>
<div class="main-cap-bottom cap-bottom">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
</div>
<footer>
<div class="footer-outer">
<div class="footer-cap-top cap-top">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
<div class="fauxborder-left footer-fauxborder-left">
<div class="fauxborder-right footer-fauxborder-right"></div>
<div class="region-inner footer-inner">
<div class="foot section" id="footer-1"><div class="widget HTML" id="HTML5">
<h2 class="title">Support This Post on DZone</h2>
<div class="widget-content">
<script type="text/javascript">var dzone_style = '2';</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script><iframe src="http://widgets.dzone.com/links/widgets/zoneit.html?t=2&amp;url=http%3A%2F%2Fblog.bdoughan.com%2F2010%2F10%2Fhow-does-jaxb-compare-to-simple.html&amp;title=Java%20XML%20%26%20JSON%20Binding%3A%20How%20Does%20JAXB%20Compare%20to%20Simple%3F" frameborder="0" height="25" scrolling="no" width="155"></iframe>
</div>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=HTML&amp;widgetId=HTML5&amp;action=editWidget&amp;sectionId=footer-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("HTML5"));' target="configHTML5" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div><div class="widget Text" id="Text1">
<h2 class="title">Disclaimer</h2>
<div class="widget-content">
The views expressed here are my own and do not necessarily reflect those of my employer.
<br>
<br>
</div>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=Text&amp;widgetId=Text1&amp;action=editWidget&amp;sectionId=footer-1" onclick='return _WidgetManager._PopupConfig(document.getElementById("Text1"));' target="configText1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div></div>
<table class="section-columns columns-2" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="first columns-cell">
<div class="foot section" id="footer-2-1"></div>
</td>
<td class="columns-cell">
<div class="foot section" id="footer-2-2"></div>
</td>
</tr>
</tbody>
</table>
<!-- outside of the include in order to lock Attribution widget -->
<div class="foot section" id="footer-3"><div class="widget Attribution" id="Attribution1">
<div class="widget-content" style="text-align: center;">
Picture Window template. Powered by <a href="http://www.blogger.com" target="_blank">Blogger</a>.
</div>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="http://www.blogger.com/rearrange?blogID=1710464868724994296&amp;widgetType=Attribution&amp;widgetId=Attribution1&amp;action=editWidget&amp;sectionId=footer-3" onclick='return _WidgetManager._PopupConfig(document.getElementById("Attribution1"));' target="configAttribution1" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18">
</a>
</span>
</span>
<div class="clear"></div>
</div></div>
</div>
</div>
<div class="footer-cap-bottom cap-bottom">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
</div>
</footer>
<!-- content -->
</div>
</div>
<div class="content-cap-bottom cap-bottom">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
</div>

    </body>
</html>
